API CHANGE: ws.close -> ws.end, ws.terminate -> ws.close

This commit is contained in:
Alex Hultman
2019-01-26 17:20:47 +01:00
parent ba10536f50
commit 7d990a3bc1
2 changed files with 6 additions and 9 deletions
+4 -7
View File
@@ -48,6 +48,9 @@ public:
/* See AsyncSocket */
using Super::getBufferedAmount;
/* Simple, immediate close of the socket. Emits close event */
using Super::close;
/* Send or buffer a WebSocket frame, compressed or not. Returns false on increased user space backpressure. */
bool send(std::string_view message, uWS::OpCode opCode = uWS::OpCode::BINARY, bool compress = false) {
/* Transform the message to compressed domain if requested */
@@ -87,7 +90,7 @@ public:
}
/* Send websocket close frame, emit close event, send FIN if successful */
void close(int code, std::string_view message = {}) {
void end(int code, std::string_view message = {}) {
/* Check if we already called this one */
WebSocketData *webSocketData = (WebSocketData *) us_new_socket_ext(SSL, (us_new_socket_t *) this);
if (webSocketData->isShuttingDown) {
@@ -122,12 +125,6 @@ public:
webSocketContextData->closeHandler(this, code, message);
}
}
/* Simple, immediate close of the socket. Emits close event */
void terminate() {
/* This calls close event in context where it checks for isShuttingDown and either emits websocket close or not */
Super::close();
}
};
}