Sends a complete close message, invoking the callback when complete

@param data The data to send
@param wsChannel The web socket channel
774434
public static void sendCloseBlocking(final ByteBuffer data, final WebSocketChannel wsChannel) throws IOException {
        sendCloseBlocking(new CloseMessage(data), wsChannel);
    }
802459
public static void sendPongBlocking(final ByteBuffer[] data, final WebSocketChannel wsChannel) throws IOException {
        sendBlockingInternal(mergeBuffers(data), WebSocketFrameType.PONG, wsChannel);
    }
1374611
async def send(self, data: Union[bytes, str], final: bool = True):
        
        MsgType = TextMessage if isinstance(data, str) else BytesMessage
        data = MsgType(data=data, message_finished=final)
        data = self._connection.send(event=data)
        await self._sock.send_all(data)
1031386
public static void sendCloseBlocking(final int code, String reason, final WebSocketChannel wsChannel) throws IOException {
        sendCloseBlocking(new CloseMessage(code, reason), wsChannel);
    }
75737
public static void sendTextBlocking(final String message, final WebSocketChannel wsChannel) throws IOException {
        final ByteBuffer data = ByteBuffer.wrap(message.getBytes(StandardCharsets.UTF_8));
        sendBlockingInternal(data, WebSocketFrameType.TEXT, wsChannel);
    }
400353
public void sendMessage(byte data)
    {
        try
        {
            out.write(data);
            out.flush();
        }
        catch (final IOException exception)
        {
            Verbose.exception(exception);
        }
    }
151077
public static void sendPing(final ByteBuffer[] data, final WebSocketChannel wsChannel, final WebSocketCallback<Void> callback) {
        sendInternal(mergeBuffers(data), WebSocketFrameType.PING, wsChannel, callback, null, -1);
    }
854329
public void send(String data, EventCallback callback) {
        send(data, null, null, callback);
    }
389877
@Override
  public void onClosing(WebSocket webSocket, int code, String reason) {
    socketOpen = false;
    callback.onDisconnected();
  }
134172
public static void sendClose(final int code, String reason, final WebSocketChannel wsChannel, final WebSocketCallback<Void> callback) {
        sendClose(new CloseMessage(code, reason), wsChannel, callback);
    }
592699
function (successCallback, errorCallback, deviceHandle) {
		winble.logger.logApiEntry("close");
		winble.deviceManager.closeDevice(successCallback, errorCallback, deviceHandle);
		winble.logger.logApiExit("close");
	}
380885
def send(self, data, opcode=ABNF.OPCODE_TEXT):
        

        if not self.sock or self.sock.send(data, opcode) == 0:
            raise WebSocketConnectionClosedException(
                "Connection is already closed.")
1064758
private void sendCloseMessage() {

        this.lock(() -> {

            TcpChannelHub.this.writeMetaDataForKnownTID(0, outWire, null, 0);

            TcpChannelHub.this.outWire.writeDocument(false, w ->
                    w.writeEventName(EventId.onClientClosing).text(""));

        }, TryLock.LOCK);

        // wait up to 1 seconds to receive an close request acknowledgment from the server
        try {
            final boolean await = receivedClosedAcknowledgement.await(1, TimeUnit.SECONDS);
            if (!await)
                if (Jvm.isDebugEnabled(getClass()))
                    Jvm.debug().on(getClass(), "SERVER IGNORED CLOSE REQUEST: shutting down the client anyway as the " +
                            "server did not respond to the close() request.");
        } catch (InterruptedException ignore) {
            Thread.currentThread().interrupt();
        }
    }
817003
def send(self, data):
        
        if not self._ws_connection:
            raise RuntimeError('Web socket connection is closed.')

        self._ws_connection.write_message(json.dumps(data))
258248
function socketOnEnd() {
  const websocket = this[kWebSocket];

  websocket.readyState = WebSocket.CLOSING;
  websocket._receiver.end();
  this.end();
}
440034
function onConnect(wsConn) {
    channel._wsConn = wsConn

    wsConn.addListener("message", onMessage)
    wsConn.addListener("close",   onClose)
    wsConn.addListener("error",   onError)

    cb(null)
  }
716145
private function send(string $data):void
    {

        socket_write($this->socket, $data, strlen($data)) or $this->error();

    }