Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WSO2 ESB 5.0.0 BETA WebSocket InboundEndPoint

Tags:

wso2-esb

I'm testing the beta release of wso2 esb 5.0.0 which has an interesting feature for me, websockets.

I declare de inbound endpoint,like the documentation define (https://docs.wso2.com/display/ESB500/WebSocket+Inbound+Protocol) but i am only be capable of receive empty messages from my client (the connection is done) and i can not be capable to send any message to my cliente.

Have any one try this feature?

Thanks.

PD: this is my ws inbound enpoint

<inboundEndpoint name="testws" onError="errorsq" protocol="ws"
    sequence="testwssq" suspend="false">
    <parameters>
        <parameter name="inbound.ws.port">9091</parameter>
        <parameter name="ws.outflow.dispatch.sequence">testbesq</parameter>
        <parameter name="ws.outflow.dispatch.fault.sequence">errorsq</parameter>
        <parameter name="ws.client.side.broadcast.level">1</parameter>
    </parameters>
</inboundEndpoint>

and these are my sequences

 <sequence name="testbesq">
    <log level="full"/>
</sequence>
<sequence name="testwssq">
    <log level="full"/>
    <log level="custom">
        <property name="request" value="message receive"/>
    </log>
</sequence>
like image 974
Josh Avatar asked Oct 19 '22 06:10

Josh


1 Answers

Unlike HTTP, which is an application-level protocol, in the WebSocket protocol there is no enough information in an incoming message to process these messages, these messages are either text or binary low-level frames. Because of this, we had to define some custom subprotocol over WebSocket. This will allow both client and server parties to know the content type of frames they communicate.

By default every Inbound endpoint support following Synapse subprotocols.

synapse(contentType='application/json')
synapse(contentType='application/xml')
synapse(contentType='text/xml')

I used Netty WebSocket client and below command to test this. And once client connected(handshake), I put message <Test>message</Test> and I could see the backend response on websocket client side.

java -DsubProtocol="synapse(contentType='application/xml')" -DclientPort=9091 -cp netty-example-4.0.30.Final.jar:lib/*:. io.netty.example.http.websocketx.client.WebSocketClient
like image 106
Chaminda Jayawardena Avatar answered Oct 21 '22 22:10

Chaminda Jayawardena