Anyone else seeing that as of 1.6 the Phoenix JS client docs are blank?
https://hexdocs.pm/phoenix/js/#socket
Chrome and Safari shows the same thing.
I just came across this because I’m seeing the same thing. I was able to figure things out from the source code - not a great long term solution of course!
/** Initializes the Socket *
*
* For IE8 support use an ES5-shim (https://github.com/es-shims/es5-shim)
*
* @param {string} endPoint - The string WebSocket endpoint, ie, `"ws://example.com/socket"`,
* `"wss://example.com"`
* `"/socket"` (inherited host & protocol)
* @param {Object} [opts] - Optional configuration
* @param {Function} [opts.transport] - The Websocket Transport, for example WebSocket or Phoenix.LongPoll.
*
* Defaults to WebSocket with automatic LongPoll fallback.
* @param {Function} [opts.encode] - The function to encode outgoing messages.
*
* Defaults to JSON encoder.
*
* @param {Function} [opts.decode] - The function to decode incoming messages.
*
* Defaults to JSON:
*
* ```javascript
This file has been truncated. show original
1 Like
ben178
December 28, 2022, 3:18am
3
Can I use this in my vanilla Js file (no js frameworks,so no NPM or such) and use these Phoenix Socket functionalities?