Update uWS, wrap unsubscribe
This commit is contained in:
parent
6b5f7c40a9
commit
b3f37ad896
@ -27,10 +27,27 @@ struct WebSocketWrapper {
|
||||
auto *ws = getWebSocket<SSL>(args);
|
||||
if (ws) {
|
||||
NativeString topic(isolate, args[0]);
|
||||
if (topic.isInvalid(args)) {
|
||||
return;
|
||||
}
|
||||
ws->subscribe(topic.getString());
|
||||
}
|
||||
}
|
||||
|
||||
/* Takes string topic, returns boolean success */
|
||||
template <bool SSL>
|
||||
static void uWS_WebSocket_unsubscribe(const FunctionCallbackInfo<Value> &args) {
|
||||
auto *ws = getWebSocket<SSL>(args);
|
||||
if (ws) {
|
||||
NativeString topic(isolate, args[0]);
|
||||
if (topic.isInvalid(args)) {
|
||||
return;
|
||||
}
|
||||
bool success = ws->unsubscribe(topic.getString());
|
||||
args.GetReturnValue().Set(Boolean::New(isolate, success));
|
||||
}
|
||||
}
|
||||
|
||||
/* Takes string topic, message */
|
||||
template <bool SSL>
|
||||
static void uWS_WebSocket_publish(const FunctionCallbackInfo<Value> &args) {
|
||||
@ -130,6 +147,7 @@ struct WebSocketWrapper {
|
||||
wsTemplateLocal->PrototypeTemplate()->Set(String::NewFromUtf8(isolate, "getBufferedAmount"), FunctionTemplate::New(isolate, uWS_WebSocket_getBufferedAmount<SSL>));
|
||||
wsTemplateLocal->PrototypeTemplate()->Set(String::NewFromUtf8(isolate, "getRemoteAddress"), FunctionTemplate::New(isolate, uWS_WebSocket_getRemoteAddress<SSL>));
|
||||
wsTemplateLocal->PrototypeTemplate()->Set(String::NewFromUtf8(isolate, "subscribe"), FunctionTemplate::New(isolate, uWS_WebSocket_subscribe<SSL>));
|
||||
wsTemplateLocal->PrototypeTemplate()->Set(String::NewFromUtf8(isolate, "unsubscribe"), FunctionTemplate::New(isolate, uWS_WebSocket_unsubscribe<SSL>));
|
||||
wsTemplateLocal->PrototypeTemplate()->Set(String::NewFromUtf8(isolate, "publish"), FunctionTemplate::New(isolate, uWS_WebSocket_publish<SSL>));
|
||||
|
||||
/* Create the template */
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 1707469cf8e89002ea1c0c7db2f5d96d37e8785d
|
||||
Subproject commit d8fe3a25b8f81d71d13a4dc134846d49ce6529ba
|
Loading…
Reference in New Issue
Block a user