I noticed that WSO2 5.0 released new functionality - websockets. I have familiarized a little bit with these tutorials:
WebSocket Support
I see that it is possible to send messages from client to WSO2/Backend via WebSockets, but I did not understand if revers communication is available - from WSO2 to client via WebSockets.
I would like to read the message from RabbitMQ in WSO2 ESB and send that message to the JavaScript client connected to the WSO2 via WebSocket.
I will appreciate any code examples.
Thank you in advance!
By assuming your jvascript as a web socket endpoint, you can merely use web socket sender [1] to send the message there.
[1] https://docs.wso2.com/display/ESB500/Sending+a+Message+from+a+HTTP+Client+to+a+WebSocket+Endpoint
Related
I'm using the spring framework's spring-graphql library to create a graphql client, as per the docs. When connecting to the server using a websocket for subscriptions, everything works fine for 5 minutes but then the websocket times out and disconnects. It turns out the server requires the client to send a ping message to keep the websocket alive. This is a graphql ping message as specified in the graphql-ws protocol
I've checked in the docs and had a dig around in the code but can't see any way to send this ping message via the spring graphql client. Apollo client has similar functionality to what I'm after via a "keepalive" option in the graplq-ws ClientOptions. Is there any equivalent I can use via spring or alternative way to solve this?
I couldn't find any way to do this so raised an issue on github, and subsequently a PR with some changes to add basic support for sending pings.
See https://github.com/spring-projects/spring-graphql/pull/608
and https://github.com/spring-projects/spring-graphql/issues/605
I'm newbie on IBM products, and I would like to know what would be the best approach to achieve the following integration solution:
A third party application that uses only AMQP to exchange messages, will put a message on an inbound queue (managed by IBM MQ)
IBM integration bus(version 10) flow will retrieve that message
Parse the message and invoke a rest api, get a response.
Parse the response, and send it back to the output queue so the third party can consume it.
My MQ colleague (amqp in new for him) created the corresponding "AMQP queue manager; channel and topic" using IBM MQ 9.0.4, and provided me of the connection info.
In my understanding I thought about creating a flow that will use "MQInput node" that will connect to the queue used by the third party to drop the message, and continue my processing.
Unfortunately I’m not able to connect to that AMQP channel, neither using: The "MQInput node" on IIB v10 Nor using "MQ explorer"
I strongly believe I miss something in that integration solution: either on the mq side or on the iib side, but not able to know what.
The challenge is to know, in order to achieve the above scenario, does the component IBM MQ and IBM Integration bus are enough, or I'll some other components?
Any documentation or tutorial that could describe/explain such scenario?
I have developed a chat application by using Spring Stomp and socketjs .
I have successfully connected to the websocket over my clients but I can not connect to websocket by using Advanced Restclient -> socket implementation.
Why?
Thanks
if i didnt use socketjs , i can succeed to connect over Advanced Rest Client. To connect websocket without using socketjs, you should set the allowed origins : setAllowedOrigins('*')
Also if you are using stomp without socketjs , you can succeed to open a websocket connection via Advanced Rest Client, because stomp just a sub-protocol over websocket connection. But to receive messages over websocket, you should subscribe to STOMP queue, it is impossible with Advanced Rest Client.
-
Restclients runs on http protocol. Restclients not yet understand the web socket and sock JS protocol. That is the reason your rest client didn't connected to server.
Is it possible to setup RabbitMQ Web STOMP connection without SockJS library?
I have played around with rabbitmq-web-stomp plugin without a success as the initial response generated by the server is Welcome to SockJS! (which is obviously not a STOMP based message).
Is SockJS really required? What does it bring into the game (besides legacy browser support)?
SockJS protocol does support raw WebSocket clients under /websocket path.
Any SockJS server complying with 0.3 protocol does support a raw WebSocket url. The raw WebSocket url for the test server looks like:
ws://localhost:8081/echo/websocket
You can connect any WebSocket RFC 6455 compliant WebSocket client to this url.
This is supported by Rabbit's implementation as well. So the default endpoint is: http://example.com:15674/stomp/websocket.
I'm looking forward to develop a realtime API for my web application using Websocket. For this I'm using RabbitMQ as the broker and My backend is based on python (gevent + websocket),and Pika/Puka as rabbitmq client.
The problem I'm facing here is that, how we can use websocket to connect with rabbitMQ. After the initial websocket connection establishment, the socket object wait for new messages from client, and in the case of rabbitMQ, we need to setup a consumer for it, so it will process the message when it receive one. We can take this in this way,
Clients are established connection with server via full-duplex websocket.
All clients should act as RabbitMQ's consumer after initial websocket handshake, so they all get updates when a client gets some message.
When new message arrives at websocket, that client will send it to RabbitMQ, so at this time this client act as publisher.
The problem is Websocket wait for a new message, and the RabbitMQ consumer wait for new message on its channel, I'm failed to link these two cases.
I'm not sure whether this is a wrong method ...
I'm unable to find a method to implement this scenario.If I'm going wrong way or is there any alternate method ?, please help me to fix this.
Thank you,
Haridas N.
I implemented similar requirement with Tornado + websocket + RabbitMQ + Pika.
I think this were already known method. Here is my git repo for this web chat application.
https://github.com/haridas/RabbitChat
It seems very difficult to the similar thing with gevent/twisted because the rabbitMQ clients couldn't supporting the event loops of gevent/twisted.
The pika has tornado adapter, so that makes this easy to setup. Pika development team working on the twisted adapter also. I hope they will release it very soon.
Thanks,
Haridas N.
http://haridas.in.
A simple solution would be to use gevent.queue.Queue instances for inter-greenlet communication.