called on new websocket message,
434972
def on_message(self, message):
        
        log.debug("WS MSG for %s: %s" % (self._get_sess_id(), message))
        self.application.pc.redirect_incoming_message(self._get_sess_id(), message, self.request)
1361217
function() {
          _ws.onmessage = function(response) {
            var data = JSON.parse(response.data);
            self.postMessage(data);
          };
        }
106704
function onServerMessage(data)
    {
        if(data.ev)
        {
            scope.dispatchEvent("onServerMessage",data);
            scope.dispatchEvent(data.ev,data);
        }
    }
990327
function Channel_sendMessage(message) {
  if (!this.wsConn) return
  if (!this.wsConn.connected) return

  DEBUGMSG("send: " + utils.JS(message))

  try {
    this.wsConn.sendUTF(JSON.stringify(message))
  }
  catch(e) {
    // occurs when socket closed, oh well
  }
}
597253
function notifyWebSocket(message) {
	if (!webSocketServer || !message)
		return;
	
	// Send the message to all connection in the WebSocket server.
	for (var value in webSocketServer.conn) {
		var connection = webSocketServer.conn[value];
		if (connection)
			connection.send(message)
	}
}
943812
function TransportClient() {
        log.info("instantiate websocket");
        // get non-ambiguous this
        var self = this;
        // Call parent constructor
        TransportClient.super_.call(self);
        // Internal structures
        self._ws = undefined;
        self._id = _.uniqueId(); // debugging tool only
        self._state = "NOT_OPENED";
        // state listeners
        self.once("open", function handleOpened() {
            self._state = "OPEN";
        }).once("close", function handleClosed() {
            self._state = "CLOSED";
        });
        // constructor - return undefined
        return undefined;
    }
333496
function sendClientConsoleMessage(ws, message) {
  var msg = JSON.stringify({
    custom: {
      console: message
    }
  });
  ws.write(msg);
}
38762
def process_msg(self, msg):
        """"""
        jmsg = json.loads(msg)
        msgtype = jmsg['MessageType']
        msgdata = jmsg['Data']

        _LOGGER.debug('New websocket message recieved of type: %s', msgtype)
        if msgtype == 'Sessions':
            self._sessions = msgdata
            # Check for new devices and update as needed.
            self.update_device_list(self._sessions)
        """
        May process other message types in the future.
        Other known types are:
        - PlaybackStarted
        - PlaybackStopped
        - SessionEnded
        """
72774
void newMessage(final byte[] message, final Session session) {
        callback.recive(serializer.deserialize(message), session);
    }
23103
async def handler(self):
    ''''''
    self.ws = await websockets.connect(self.url, ssl=self.ssl)
    while self.ws:
      message = await self.ws.recv()
      for handle in self.on_message:
        if asyncio.iscoroutinefunction(handle):
          await handle(self, message)
        else:
          handle(self, message)
693661
function (ws, message) {
  let clientMessage;

  try {
    clientMessage = JSON.parse(message);
    /* jshint ignore:start */
    if (_.get(clientMessage, 'type') === 'message') {
      ws.send(JSON.stringify({
        ok: true,
        reply_to: _.get(clientMessage, 'id'),
        ts: Date.now(),
        message: _.get(clientMessage, 'text', message),
        type: _.get(clientMessage, 'type', 'message'),
        user: _.get(clientMessage, 'user', 'U1234567'),
        channel: _.get(clientMessage, 'channel', 'C1234567'),
      }));
    }
    /* jshint ignore:end */
  } catch (err) {
    logger.info('Invalid socket data ', message);
  }
}
564531
def _onMessage(self, ws, message):
        
        try:
            data = json.loads(message)['NotificationContainer']
            log.debug('Alert: %s %s %s', *data)
            if self._callback:
                self._callback(data)
        except Exception as err:  # pragma: no cover
            log.error('AlertListener Msg Error: %s', err)
258248
function socketOnEnd() {
  const websocket = this[kWebSocket];

  websocket.readyState = WebSocket.CLOSING;
  websocket._receiver.end();
  this.end();
}
288692
public void onMessage(WSMessage message) {
        log.trace("Listeners: {}", listeners.size());
        for (IWebSocketDataListener listener : listeners) {
            try {
                listener.onWSMessage(message);
            } catch (Exception e) {
                log.warn("onMessage exception", e);
            }
        }
    }
384058
def on_message(self, message):
        
        self._record_activity()
        if hasattr(self, 'ws'):
            self.ws.write_message(message, binary=isinstance(message, bytes))
303346
public function onReady()
    {
        \PHPDaemon\Servers\WebSocket\Pool::getInstance()->addRoute(
            '/sockjs',
            function ($client) {
                return new SimpleRoute($client, $this);
            }
        );
    }
1233577
def _ws_on_error(self, ws: websocket.WebSocketApp, error: Exception):
        
        self.logger.error(f'Got error from websocket connection: {str(error)}')