Send a message to the socket for the given session ID.
494149
def send(session_id, message):
    
    try:
        socket = CLIENTS[session_id][1]
    except KeyError:
        raise NoSocket("There is no socket with the session ID: " + session_id)
    socket.send(message)
794814
def send(self, msg):
        """"""
        def reconnect(e):
            self.log.error('send error, reconnecting...', exc_info=True)
            self.connect_ensime_server()
            if self.ws:
                self.ws.send(msg + "\n")

        self.log.debug('send: in')
        if self.running and self.ws:
            with catch(websocket.WebSocketException, reconnect):
                self.log.debug('send: sending JSON on WebSocket')
                self.ws.send(msg + "\n")
1331189
def send_message(client, message):
    """"""
    print(message)
    client.send("HTTP/1.1 200 OK\r\n\r\n{}".format(message).encode("utf-8"))
    client.close()
1119929
private void send( String message ) {

		if( ! this.enabled.get()) {
			this.logger.finest( "Notifications were disabled by the DM." );

		} else if( message == null ) {
			this.logger.finest( "No message to send to web socket clients." );

		} else synchronized( SESSIONS ) {
			for( Session session : SESSIONS ) {
				try {
					this.logger.finest( "Sending a message to a web socket client..." );
					session.getRemote().sendString( message );

				} catch( IOException e ) {
					StringBuilder sb = new StringBuilder( "A notification could not be propagated for session " );
					sb.append( session.getRemoteAddress());
					sb.append( "." );
					if( ! Utils.isEmptyOrWhitespaces( e.getMessage()))
						sb.append( " " + e.getMessage());

					this.logger.severe( sb.toString());
					Utils.logException( this.logger, e );
				}
			}
		}
	}
893935
@Override
  public void reply(WebSocket session,
                    HeadersAmp headers,
                    String to,
                    long qid,
                    Object value)
     throws IOException
  {
    /*
    try (OutputStream os = session.getBasicRemote().getSendStream()) {
      queryResult(os, headers, to, qid, value);
    }
    */
  }
1222318
def send_message(self, destination_id, namespace, data,
                     inc_session_id=False, callback_function=False,
                     no_add_request_id=False, force=False):
        

        # namespace is a string containing namespace
        # data is a dict that will be converted to json
        # wait_for_response only works if we have a request id

        # If channel is not open yet, connect to it.
        self._ensure_channel_connected(destination_id)

        request_id = None
        if not no_add_request_id:
            request_id = self._gen_request_id()
            data[REQUEST_ID] = request_id

        if inc_session_id:
            data[SESSION_ID] = self.session_id

        # pylint: disable=no-member
        msg = cast_channel_pb2.CastMessage()

        msg.protocol_version = msg.CASTV2_1_0
        msg.source_id = self.source_id
        msg.destination_id = destination_id
        msg.payload_type = cast_channel_pb2.CastMessage.STRING
        msg.namespace = namespace
        msg.payload_utf8 = _json_to_payload(data)

        # prepend message with Big-Endian 4 byte payload size
        be_size = pack(">I", msg.ByteSize())

        # Log all messages except heartbeat
        if msg.namespace != NS_HEARTBEAT:
            self.logger.debug("[%s:%s] Sending: %s",
                              self.fn or self.host, self.port,
                              _message_to_string(msg, data))

        if not force and self.stop.is_set():
            raise PyChromecastStopped("Socket client's thread is stopped.")
        if not self.connecting and not self._force_recon:
            try:
                if not no_add_request_id and callback_function:
                    self._request_callbacks[request_id] = {
                        'event': threading.Event(),
                        'response': None,
                        'function': callback_function,
                    }
                self.socket.sendall(be_size + msg.SerializeToString())
            except socket.error:
                self._request_callbacks.pop(request_id, None)
                self._force_recon = True
                self.logger.info('[%s:%s] Error writing to socket.',
                                 self.fn or self.host, self.port)
        else:
            raise NotConnected("Chromecast " + self.host + ":" +
                               str(self.port) + " is connecting...")
1187393
def send_request(id, method, params)
      data = MessagePack.dump([0, id, method, params]).bytes
      ws.send(data)
    rescue => exc
      warn exc
      abort exc
    end
362804
function(id, socket) {
  EventEmitter.call(this);
  this.id = id;
  this.socket = socket;

  if(!socket._socket) {
    this.remoteAddress = {
      ip: socket.address().address,
      port: socket.address().port
    };
  } else {
    this.remoteAddress = {
      ip: socket._socket.remoteAddress,
      port: socket._socket.remotePort
    };
  }

  var self = this;

  socket.once('close', this.emit.bind(this, 'disconnect'));
  socket.on('error', this.emit.bind(this, 'error'));

  socket.on('message', function(msg) {
    if(msg) {
      msg = Package.decode(msg);
      handler(self, msg);
    }
  });

  this.state = ST_INITED;

  // TODO: any other events?
}
26937
public void sendBroadcast(CmsObject cms, String message, String sessionId) {

        sendBroadcast(cms, message, sessionId, false);

    }
396228
public void onMessage(String sessionId, ByteBuffer buffer) {
        WebSocketSession session = WsonrpcRemotes.getSession(sessionId);
        byte[] bytes = buffer.array();
        WsonrpcSessions.begin(session);
        try {
            fireMessage(sessionId, bytes);
            wsonrpcControl.handle(session, bytes);
        } catch (Exception ex) {
            onError(session.getId(), ex);
        } finally {
            WsonrpcSessions.end();
        }
    }
1033553
def send_private_message(self, user_id, message):
        
        try:
            client = self.channels['private'][str(user_id)]
        except KeyError:
            print '====debug===='
            print self.channels['private']
            print 'client with id %s not found' % user_id
            return False
        
        client.send_message(message)
        print 'message sent to client #%s' % user_id
        return True
216964
def send(self, op, cmd, integration_id, *args):
    """"""
    out_cmd = ",".join(
        (cmd, str(integration_id)) + tuple((str(x) for x in args)))
    self._conn.send(op + out_cmd)
741195
def send(self, message):
        """"""
        serialized = message.SerializeToString()

        log_binary(_LOGGER, '>> Send', Data=serialized)
        if self._chacha:
            serialized = self._chacha.encrypt(serialized)
            log_binary(_LOGGER, '>> Send', Encrypted=serialized)

        data = write_variant(len(serialized)) + serialized
        self._transport.write(data)
        _LOGGER.debug('>> Send: Protobuf=%s', message)
376390
def send_message(self, msg, connection_id=None):
        
        zmq_identity = None
        if connection_id is not None and self._connections is not None:
            if connection_id in self._connections:
                connection_info = self._connections.get(connection_id)
                if connection_info.connection_type == \
                        ConnectionType.ZMQ_IDENTITY:
                    zmq_identity = connection_info.connection
            else:
                LOGGER.debug("Can't send to %s, not in self._connections",
                             connection_id)

        self._ready.wait()

        if zmq_identity is None:
            message_bundle = [msg.SerializeToString()]
        else:
            message_bundle = [bytes(zmq_identity),
                              msg.SerializeToString()]

        try:
            asyncio.run_coroutine_threadsafe(
                self._send_message_frame(message_bundle),
                self._event_loop)
        except RuntimeError:
            # run_coroutine_threadsafe will throw a RuntimeError if
            # the eventloop is closed. This occurs on shutdown.
            pass
76276
function(id, msg, meta) {
        var socket = openSocketsById[id];
        if (socket) {
          return socket.send('0|' + msg + '|' + meta);
        } else {
          return false;
        }
      }
285798
def send(self, message):
        """"""
        if not message or not self.protocol or not self.protocol.transport:
            return
        if not self.can_log:
            _LOGGER.debug('Sending %s', message.strip())
        try:
            self.protocol.transport.write(message.encode())
        except OSError as exc:
            _LOGGER.error(
                'Failed writing to transport %s: %s',
                self.protocol.transport, exc)
            self.protocol.transport.close()
            self.protocol.conn_lost_callback()
96696
def send(self):
        
        from neobolt.exceptions import ConnectionExpired
        if self._connection:
            try:
                self._connection.send()
            except ConnectionExpired as error:
                raise SessionExpired(*error.args)