How does one use the Defold extension-websocket Extension params?

#1

Dear Defolder,
the sample code for the extension shows “params” as an empty table, but I need to send a wsprotocol. How do I use the “params” table in the new “extension-websocket” extension?

Note: The official documentation (Defold extension-websocket) DOES show a listing in the PARAMETERS for the “params” table but, and I am assuming this is a mistake, the documentation reads the parameters as:
28en%20tago
Note how the reference to params claims that “The following parameters can be set” but then follows with no parameters. Most likely a doc problem because the docs were put up pretty recently if I’m not mistaken

Thanks,
grify

0 Likes

#2

The example shows an empty Lua table:

And the actual code doesn’t read the table:

So at this point the params table is unused.

What do you mean? wss:// or ws:/ ?

1 Like

#3

Hi Britzl!
Thanks for your insightful reply! :slight_smile:

Will it be added to in upcoming updates?

I mean that I need to send a wss connection with a connectionProtocol, referred to in nodeJS as “req.requestedProtocols[0]” (connectionProtocol is a string that is sent along with the ws connect request, usually to request a certain format, device, or get the server to acknowledge something or categorize the connection differently than a standard connection)

In the old defold-websocket extension, the syntax was to accept the second string parameter in the ws:connect as the protocol (example: self.ws:connect("ws://domain.ext", "protocol"))

Thank you for helping me,
grify

0 Likes

#4

Please open a ticket in the extension-websocket repository on GitHub and request this feature!

2 Likes

#5

Correct, it isn’t yet supported, but as @britzl pointed out, I left some (commented out) helper in there, in order to help the person implementing the feature.

For others reading this, here’s the ticket:

2 Likes