WebSocketOptions
ClassAdditional settings applied when opening a WebSocket connection with InternetModule#createWebSocket.
- Snapchat: not supported
- SPECS: fully supported
- Camera Kit Web: fully supported
- Camera Kit Mobile: fully supported
- SnapchatNot supported — Available on SPECS and Camera Kit only
- SPECSFully supported
- Camera Kit WebFully supported
- Camera Kit MobileFully supported
Additional settings applied when opening a WebSocket connection with InternetModule#createWebSocket. All fields are optional; unset fields fall back to the connection defaults.
Index
Properties
Methods
Example
//@input Asset.InternetModule internetModule
const options = script.internetModule.createWebSocketOptions();
options.headers = { "Authorization": `Bearer ${token}` };
const socket = script.internetModule.createWebSocket("wss://<some-url>", undefined, options);
Extends
Properties
headers
headers:
object
SPECSCamera Kit
Extra HTTP headers to send on the WebSocket opening handshake, as a map of header name to value. Defaults to an empty set of headers.
Index Signature
[key: string]: string
Default Value
{}
@snapOS
@cameraKit
Methods
getTypeName()
staticgetTypeName():TypeName<WebSocketOptions>
SPECSCamera Kit
Returns the fully-qualified JavaScript type name for this class (for example, "Component.Camera"). This is a static accessor (no instance required) and returns the same value as the instance getTypeName().
Returns
TypeName<WebSocketOptions>
Overrides
getTypeName()
getTypeName():
string
Returns the name of this object's type.
Returns
string
Inherited from
isOfType()
isOfType(
type):boolean
Returns true if the object matches or derives from the passed in type.
Parameters
| Parameter | Type |
|---|---|
type | string |
Returns
boolean
Inherited from
isSame()
isSame(
other):boolean
Returns true if this object is the same as other. Useful for checking if two references point to the same thing.
Parameters
| Parameter | Type |
|---|---|
other | ScriptObject |
Returns
boolean
Inherited from
See also
InternetModule#createWebSocketOptions