Skip to main content

WebSocketOptions

Class

Additional 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

Platform details

  • Snapchat — Not supported — Available on SPECS and Camera Kit only.

  • SPECS — Fully supported.

  • Camera Kit Web — Fully supported.

  • Camera Kit Mobile — Fully 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

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()

static getTypeName(): 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

ScriptObject.getTypeName


getTypeName()

getTypeName(): string

Returns the name of this object's type.

Returns

string

Inherited from

ScriptObject.getTypeName


isOfType()

isOfType(type): boolean

Returns true if the object matches or derives from the passed in type.

Parameters

ParameterType
typestring

Returns

boolean

Inherited from

ScriptObject.isOfType


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

ParameterType
otherScriptObject

Returns

boolean

Inherited from

ScriptObject.isSame

See also

InternetModule#createWebSocketOptions