Skip to content

Commit 59662d7

Browse files
committed
Update for API change: ws.end, ws.close
1 parent c66e383 commit 59662d7

3 files changed

Lines changed: 8 additions & 9 deletions

File tree

‎src/WebSocketWrapper.h‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,17 @@ struct WebSocketWrapper {
2626

2727
/* Takes nothing returns nothing */
2828
template <bool SSL>
29-
static void uWS_WebSocket_terminate(const FunctionCallbackInfo<Value> &args) {
29+
static void uWS_WebSocket_close(const FunctionCallbackInfo<Value> &args) {
3030
auto *ws = getWebSocket<SSL>(args);
3131
if (ws) {
3232
invalidateWsObject(args);
33-
ws->terminate();
33+
ws->close();
3434
}
3535
}
3636

3737
/* Takes code, message, returns undefined */
3838
template <bool SSL>
39-
static void uWS_WebSocket_close(const FunctionCallbackInfo<Value> &args) {
39+
static void uWS_WebSocket_end(const FunctionCallbackInfo<Value> &args) {
4040
auto *ws = getWebSocket<SSL>(args);
4141
if (ws) {
4242
int code = 0;
@@ -50,7 +50,7 @@ struct WebSocketWrapper {
5050
}
5151

5252
invalidateWsObject(args);
53-
ws->close(code, message.getString());
53+
ws->end(code, message.getString());
5454
}
5555
}
5656

@@ -92,8 +92,8 @@ struct WebSocketWrapper {
9292

9393
/* Register our functions */
9494
wsTemplateLocal->PrototypeTemplate()->Set(String::NewFromUtf8(isolate, "send"), FunctionTemplate::New(isolate, uWS_WebSocket_send<SSL>));
95+
wsTemplateLocal->PrototypeTemplate()->Set(String::NewFromUtf8(isolate, "end"), FunctionTemplate::New(isolate, uWS_WebSocket_end<SSL>));
9596
wsTemplateLocal->PrototypeTemplate()->Set(String::NewFromUtf8(isolate, "close"), FunctionTemplate::New(isolate, uWS_WebSocket_close<SSL>));
96-
wsTemplateLocal->PrototypeTemplate()->Set(String::NewFromUtf8(isolate, "terminate"), FunctionTemplate::New(isolate, uWS_WebSocket_terminate<SSL>));
9797
wsTemplateLocal->PrototypeTemplate()->Set(String::NewFromUtf8(isolate, "getBufferedAmount"), FunctionTemplate::New(isolate, uWS_WebSocket_getBufferedAmount<SSL>));
9898

9999
/* Create the template */

‎tests/Hammer.js‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ function performRandomServerAction(ws, uniform) {
127127

128128
switch (action) {
129129
case 0: {
130-
ws.close();
130+
ws.end();
131131
break;
132132
}
133133
case 1: {
@@ -142,8 +142,7 @@ function performRandomServerAction(ws, uniform) {
142142
break;
143143
}
144144
case 2: {
145-
/* This should correspond to hard us_socket_close */
146-
ws.terminate();
145+
ws.close();
147146
break;
148147
}
149148
}

‎uWebSockets‎

0 commit comments

Comments
 (0)