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

**URL:** <https://forum.defold.com/t/how-does-one-use-the-defold-extension-websocket-extension-params/66363>\
**Category:** Bugs\
**Created:** [September 19, 2020, 7:54am UTC](https://forum.defold.com/t/how-does-one-use-the-defold-extension-websocket-extension-params/66363 "2020-09-19T07:54:35Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Griffin](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/griffin/32/36764_2.png) [@Griffin](https://forum.defold.com/u/Griffin)\
**Post date:** [September 19, 2020, 7:54am UTC](https://forum.defold.com/t/how-does-one-use-the-defold-extension-websocket-extension-params/66363/1 "2020-09-19T07:54:35Z")

</div>

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](https://forum-defold-uploads.b-cdn.net/original/3X/5/8/589a1fc29587e626c825946977eb4666546c6029.png)  
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

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [September 19, 2020, 7:17pm UTC](https://forum.defold.com/t/how-does-one-use-the-defold-extension-websocket-extension-params/66363/2 "2020-09-19T19:17:52Z")

</div>

The example shows an empty Lua table:

> <https://github.com/defold/extension-websocket/blob/master/examples/websocket.gui_script>

And the actual code doesn’t read the table:

> <https://github.com/defold/extension-websocket/blob/master/websocket/src/websocket.cpp#L173-L197>

So at this point the params table is unused.

> [@Griffin](#):
>
> I need to send a wsprotocol

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

---

<div class="post-metadata">

**Author:** ![Griffin](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/griffin/32/36764_2.png) [@Griffin](https://forum.defold.com/u/Griffin)\
**Post date:** [September 20, 2020, 7:44am UTC](https://forum.defold.com/t/how-does-one-use-the-defold-extension-websocket-extension-params/66363/3 "2020-09-20T07:44:38Z")

</div>

Hi Britzl!  
Thanks for your insightful reply! 🙂

> [@britzl](#):
>
> So at this point the params table is unused.
> 
> ![](https://forum.defold.com/user_avatar/forum.defold.com/grify/40/18407_2.png) grify:

Will it be added to in upcoming updates?

> [@britzl](#):
>
> What do you mean? wss:// or ws:/ ?

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

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [September 20, 2020, 8:58am UTC](https://forum.defold.com/t/how-does-one-use-the-defold-extension-websocket-extension-params/66363/4 "2020-09-20T08:58:48Z")

</div>

> [@Griffin](#):
>
> 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)

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

---

<div class="post-metadata">

**Author:** ![Mathias\_Westerdahl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mathias_westerdahl/32/228_2.png) [@Mathias\_Westerdahl](https://forum.defold.com/u/Mathias_Westerdahl)\
**Post date:** [September 21, 2020, 7:21am UTC](https://forum.defold.com/t/how-does-one-use-the-defold-extension-websocket-extension-params/66363/5 "2020-09-21T07:21:48Z")

</div>

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:  
[https://github.com/defold/extension-websocket/issues/5](https://github.com/defold/extension-websocket/issues/5)
