Ejemplo n.º 1
0
 private void notifyMessage(WebSocketFrame frame)
 {
     try {
         if (frame.getOpCode() == WebSocketFrameConstants.TEXT)
         {
             listener.OnMessage(frame.getPayloadAsString());
         }
         else
         {
             listener.OnMessage(frame.getPayload(), 0, frame.getPayloadLength());
         }
     } catch (Exception) {
         // discard exceptions thrown by the listener
     }
 }
Ejemplo n.º 2
0
 private void notifyMessage(byte[] payload, int payloadLength)
 {
     try {
         String payloadString = System.Text.Encoding.UTF8.GetString(payload, 0, payloadLength);
         listener.OnMessage(payloadString);
     } catch (Exception) {
         // discard exceptions thrown by the listener
     }
 }