Update to uWS v0.16.1, wrap app.publish
This commit is contained in:
parent
ea8d4c784d
commit
97bff11ba0
@ -232,6 +232,15 @@ void uWS_App_listen(const FunctionCallbackInfo<Value> &args) {
|
||||
args.GetReturnValue().Set(args.Holder());
|
||||
}
|
||||
|
||||
template <typename APP>
|
||||
void uWS_App_publish(const FunctionCallbackInfo<Value> &args) {
|
||||
APP *app = (APP *) args.Holder()->GetAlignedPointerFromInternalField(0);
|
||||
|
||||
NativeString topic(isolate, args[0]);
|
||||
NativeString message(isolate, args[1]);
|
||||
app->publish(topic.getString(), message.getString(), args[2]->BooleanValue(isolate->GetCurrentContext()).ToChecked() ? uWS::OpCode::BINARY : uWS::OpCode::TEXT, args[3]->BooleanValue(isolate->GetCurrentContext()).ToChecked());
|
||||
}
|
||||
|
||||
template <typename APP>
|
||||
void uWS_App(const FunctionCallbackInfo<Value> &args) {
|
||||
Local<FunctionTemplate> appTemplate = FunctionTemplate::New(isolate);
|
||||
@ -356,6 +365,7 @@ void uWS_App(const FunctionCallbackInfo<Value> &args) {
|
||||
/* ws, listen */
|
||||
appTemplate->PrototypeTemplate()->Set(String::NewFromUtf8(isolate, "ws"), FunctionTemplate::New(isolate, uWS_App_ws<APP>));
|
||||
appTemplate->PrototypeTemplate()->Set(String::NewFromUtf8(isolate, "listen"), FunctionTemplate::New(isolate, uWS_App_listen<APP>));
|
||||
appTemplate->PrototypeTemplate()->Set(String::NewFromUtf8(isolate, "publish"), FunctionTemplate::New(isolate, uWS_App_publish<APP>));
|
||||
|
||||
Local<Object> localApp = appTemplate->GetFunction(isolate->GetCurrentContext()).ToLocalChecked()->NewInstance(isolate->GetCurrentContext()).ToLocalChecked();
|
||||
localApp->SetAlignedPointerInInternalField(0, app);
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit d8fe3a25b8f81d71d13a4dc134846d49ce6529ba
|
||||
Subproject commit 49f460ef208e88da3e23b5cadba8a2f952d0763b
|
Loading…
Reference in New Issue
Block a user