SpectaclesMobileKitSession
ClassSpectacles Mobile Kit session allows you to initiate the connection to peer, and send data.
- Snapchat: not supported
- SPECS: fully supported
- Camera Kit Web: not supported
- Camera Kit Mobile: not supported
- SnapchatNot supported — Available on SPECS only
- SPECSFully supported
- Camera Kit WebNot supported — Available on SPECS only
- Camera Kit MobileNot supported — Available on SPECS only
Spectacles Mobile Kit session allows you to initiate the connection to peer, and send data.
Index
Properties
Methods
Extends
Properties
isConnected
readonlyisConnected:boolean
SPECS
True if we’re connected to the peer.
onConnected
readonlyonConnected:event0<void>
SPECS
Notified when the connection to the peer is established and ready.
onDisconnected
readonlyonDisconnected:event0<void>
SPECS
Triggered when the connection to the peer is severed. The session is no longer valid and must be re-created.
onError
readonlyonError:event1<string,void>
SPECS
Triggered if the session fails to start (e.g. permission denied or the companion-bridge service rejected the request). The session is no longer valid and must be re-created.
Methods
close()
close():
void
SPECS
Disconnect and stop the session. Session object will be invalid after this call and will need to be re-created.
Returns
void
getTypeName()
staticgetTypeName():TypeName<SpectaclesMobileKitSession>
SPECS
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<SpectaclesMobileKitSession>
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
sendData()
sendData(
data):void
SPECS
Use sendData() to send a one-way message to the connected mobile app. This is a fire-and-forget operation, no response is expected.
Parameters
| Parameter | Type |
|---|---|
data | string |
Returns
void
sendRequest()
sendRequest(
data):Promise<string>
SPECS
Send a request expecting a response from the peer. Returns a promise with the response.
Parameters
| Parameter | Type |
|---|---|
data | string |
Returns
Promise<string>
start()
start():
void
SPECS
Initialize the session before interacting with the app. Ensure that all callbacks and events are configured prior to calling this method. This action creates the session and begins listening for incoming connections.
Returns
void
startSubscription()
startSubscription(
data,onError):event1<string,void>
SPECS
Start a subscription, multiple responses can be sent by the peer. Returns the subscription event. onError will be called if the subscription is cancelled by peer.
Parameters
| Parameter | Type |
|---|---|
data | string |
onError | (error) => void |
Returns
event1<string, void>
stopSubscription()
stopSubscription(
id):void
SPECS
Stop the subscription.
Parameters
| Parameter | Type |
|---|---|
id | event1<string, void> |
Returns
void