Closed KabDeveloper closed 5 years ago
This sounds more like a question about using WebSockets in Go than anything specific to this client. Also, note that RabbitMQ supports STOMP over WebSockets and MQTT over WebSockets which I'd consider. STOMP and MQTT clients can interoperate with AMQP 0-9-1 clients that use this library, although with some reasonable limitations.
@michaelklishin Hi and thanks for your answer.
But my question is not related to your answer, I am not looking for client browser integration but a way to pass websocket message in the server side using channels to the worker responsible to produce them throue websockets and send them to the client browser.
I am not looking for the browser side, but only sending message using channel from the main program to the worker for better performances. It is specific for this client, sorry if I didn't exposed in the right way my concern.
I'm not sure what the question really is. You can consume from a Go channel and publish on an amqp
channel. This library does not impose a lot of limitations on how that can be done. Concurrent publishing on a shared amqp
channel is not supported in the protocol, so you have to batch and synchronise. That's pretty much the only limitation. Publisher side data safety is another concern that makes this a less-than-trivial problem.
HI,
How to use AMQP in order to create one instance (Go Routine) that listen for my webserver to receive data, manipulate them and then Publish messages using websocket to users's browser.
I am not looking for all the code but for this particulary:
And this worker must be launched one time only and working in concurrency with my main program.
I checked this example: https://github.com/streadway/amqp/blob/master/_examples/pubsub/pubsub.go
But I can't see how it is possible to send message using channels to the producer ? and this can be done anytime and from any part of my code.
I mean a way to pass directly channel message to Publish GoRoutine function (This function must be working in LOOP in concurrency with my program so I can pass messages and then publish them to users).
Your guidance will be welcomed, thanks in advance.