0
votes

my plan is to use the azure queue storage between the web app and a webjob. The app receives a job from the user (for example the user enters an URL); the app sends the message to the queue; the webjob receives the message in the queue with the URL and takes & saves a screenshot from the page.

Now how can the webjob notifies the app/user that the job is done and that the picture was saved? I thought about websockets; but websockets doesn't work in webjobs.

So any good ideas?

Thank you very much and best regards!

See basic setup:

1
You could explore SignalR, I would use this for reference. - Hari Hara Chandan

1 Answers

0
votes

Actually, web sockets is a great way to accomplish that and you can use web sockets from within a web job. Here's some sample code...

// this is app.js
// one of the code file types that web jobs will take is a .js file
// keep in mind that you have to deploy the node_modules
// folder with the socket.io-client module in it for this web job to work

var socket = require('socket.io-client')('<socket server>');
socket.emit('update', 'socket msg from web job');

I've done this before with good success. Keep in mind that message queues are a very decoupled technology, and web sockets are a very coupled. You may want to have some retry and validation logic that makes sure that messages have arrived if that's important to you.