tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Ricles <>
Subject Websocket @OnMessage is never firing for binary messages only text
Date Tue, 18 Nov 2014 19:14:21 GMT
I am writing a websocket communication with the client and server
endpoints both in java code (using tomcat 7.0.53 as the web server)
When I send a text message using the
session.getbasicremote.sendText(String) method the @Onmessage function
is fired and everything. However I want to send binary data between
the websockets so thus have to use
session.getbasicremote.sendBinary(ByteBuffer). The code should then be
read within the following method,

public void recieved(ByteBuffer byteBuffer)

However the method is never fired when the message is sent (I debugged
through both remote debugging and print statements to verify that the
binary data is being sent also yes regular text does get sent through
this method when binary is switched to text). Does anyone have a clue
why this method is never being called when the data is sent from the
other end of the websocket? Here is also the code for the part where
the binary data is sent over the websocket. Also the @onError methods
are in the classes and never called either.

public void SendMessage() throws IOException
    for(int i = 0;i<MESSAGE_SIZE;i++)
    for(int i = 0;i<ID_SIZE;i++)
    ByteBuffer bbuf = ByteBuffer.allocate(1000);
    for(Session session : sessionList)

Jason Ricles

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message