larksuite-oapi/src/main/java/com/larksuite/oapi/okhttp3_14/internal/ws/WebSocketWriter.java
void writeClose(int code, ByteString reason) throws IOException {
    ByteString payload = ByteString.EMPTY;
    if (code != 0 || reason != null) {
      if (code != 0) {
        validateCloseCode(code);
      }
      Buffer buffer = new Buffer();
      buffer.writeShort(code);
      if (reason != null) {
        buffer.write(reason);
      }
      payload = buffer.readByteString();
    }

    try {
      writeControlFrame(OPCODE_CONTROL_CLOSE, payload);
    } finally {
      writerClosed = true;
    }
  }
/**
   * Send a close frame with optional code and reason.
   *
   * @param code Status code as defined by <a
   * href="http://tools.ietf.org/html/rfc6455#section-7.4">Section 7.4 of RFC 6455</a> or {@code 0}.
   * @param reason Reason for shutting down or {@code null}.
   */
Send a close frame with optional code and reason.
@param code Status code as defined by Section 7.4 of RFC 6455 or  0.
@param reason Reason for shutting down or  null.
Send a close frame with optional code and reason . @param code Status code as defined by Section 7 . 4 of RFC 6455 or 0 . @param reason Reason for shutting down or null .
void writeClose(int code, ByteString reason) throws IOException {
    ByteString payload = ByteString.EMPTY;
    if (code != 0 || reason != null) {
      if (code != 0) {
        validateCloseCode(code);
      }
      Buffer buffer = new Buffer();
      buffer.writeShort(code);
      if (reason != null) {
        buffer.write(reason);
      }
      payload = buffer.readByteString();
    }
    try {
      writeControlFrame(OPCODE_CONTROL_CLOSE, payload);
    } finally {
      writerClosed = true;
    }
  }
void writeClose ( int code , ByteString reason ) throws IOException { ByteString payload = ByteString . EMPTY ; if ( code != 0 || reason != null ) { if ( code != 0 ) { validateCloseCode ( code ) ; } Buffer buffer = new Buffer ( ) ; buffer . writeShort ( code ) ; if ( reason != null ) { buffer . write ( reason ) ; } payload = buffer . readByteString ( ) ; } try { writeControlFrame ( OPCODE_CONTROL_CLOSE , payload ) ; } finally { writerClosed = true ; } }
Send a close frame with optional code and reason.
Send a close frame with optional code and reason .