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,
@OnMessage public void recieved(ByteBuffer byteBuffer) { System.out.println(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++) message+='\0'; for(int i = 0;i<ID_SIZE;i++) id+='\0'; ByteBuffer bbuf = ByteBuffer.allocate(1000); bbuf.put(id.getBytes()); bbuf.position(33); bbuf.putInt(33,length); bbuf.position(37); bbuf.put(message.getBytes()); for(Session session : sessionList) session.getBasicRemote().sendBinary(bbuf); System.out.println("sent"); } Jason Ricles --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org