OptionalauthOptionalbinaryThe binary type to use for binary WebSocket frames.
Defaults to "arraybuffer"
OptionaldebugWhen true, enables debug logging. Default false.
OptionaldecodeThe function to decode incoming messages.
Defaults to JSON:
(payload, callback) => callback(JSON.parse(payload))
OptionalencodeThe function to encode outgoing messages.
Defaults to JSON encoder.
OptionalheartbeatThe millisec interval to send a heartbeat message.
Defaults to 30000.
OptionalloggerThe optional function for specialized logging, ie:
function(kind, msg, data) {
console.log(`${kind}: ${msg}`, data)
}
OptionallongpollerThe maximum timeout of a long poll AJAX request.
Defaults to 20s (double the server long poll timer).
OptionallongThe millisecond time to attempt the primary transport before falling back to the LongPoll transport. Disabled by default.
OptionalparamsThe optional params to pass when connecting.
OptionalreconnectThe optional function that returns the socket reconnect interval, in milliseconds.
Defaults to stepped backoff of:
function(tries){
return [10, 50, 100, 150, 200, 250, 500, 1000, 2000][tries - 1] || 5000
}
OptionalrejoinThe optional function that returns the millisec rejoin interval for individual channels.
function(tries){
return [1000, 2000, 5000][tries - 1] || 10000
}
OptionalsessionAn optional Storage compatible object
Phoenix uses sessionStorage for longpoll fallback history. Overriding the store is
useful when Phoenix won't have access to sessionStorage. For example, This could
happen if a site loads a cross-domain channel in an iframe. Example usage:
class InMemoryStorage {
constructor() { this.storage = {} }
getItem(keyName) { return this.storage[keyName] || null }
removeItem(keyName) { delete this.storage[keyName] }
setItem(keyName, keyValue) { this.storage[keyName] = keyValue }
}
OptionaltimeoutThe default timeout in milliseconds to trigger push timeouts.
Defaults to 10000
OptionaltransportThe Websocket Transport, for example WebSocket or Phoenix.LongPoll.
Defaults to WebSocket with automatic LongPoll fallback if WebSocket is not defined.
To fallback to LongPoll when WebSocket attempts fail, use longPollFallbackMs: 2500.
OptionalvsnThe serializer's protocol version to send on connect.
Defaults to "2.0.0".
The optional authentication token to be exposed on the server under the
:auth_tokenconnect_info key.