API reference
API reference
Select your platform
No SDKs available
No versions available

WitWebSocketAdapter Class

Extends MonoBehaviour
A publish/subscribe MonoBehaviour adapter for WitWebSocketClients

Fields

WebSocketProvider : IWitWebSocketClientProvider
The script used to provide the WitWebSocketClient
Signature
IWitWebSocketClientProvider Meta.Voice.Net.WebSockets.WitWebSocketAdapter.WebSocketProvider

Properties

Logger : IVLogger
[Get]
Signature
IVLogger Meta.Voice.Net.WebSockets.WitWebSocketAdapter.Logger
OnSubscribed : UnityEvent
[Get]
Callback when successfully subscribed to the current topic
Signature
UnityEvent Meta.Voice.Net.WebSockets.WitWebSocketAdapter.OnSubscribed
OnUnsubscribed : UnityEvent
[Get]
Callback when successfully unsubscribed from the current topic
Signature
UnityEvent Meta.Voice.Net.WebSockets.WitWebSocketAdapter.OnUnsubscribed
SubscriptionState : PubSubSubscriptionState
[Get]
The current subscription state of the adapter
Signature
PubSubSubscriptionState Meta.Voice.Net.WebSockets.WitWebSocketAdapter.SubscriptionState
TopicId : string
[Get][Set]
The topic to be used for publishing/subscribing to the current client provider
Signature
string Meta.Voice.Net.WebSockets.WitWebSocketAdapter.TopicId
WebSocketClient : IWitWebSocketClient
[Get]
The current web socket client
Signature
IWitWebSocketClient Meta.Voice.Net.WebSockets.WitWebSocketAdapter.WebSocketClient

Events

OnRequestGenerated : Action< IWitWebSocketRequest >
Callback when a request is generated for the subscribed topic
Signature
Action<IWitWebSocketRequest> Meta.Voice.Net.WebSockets.WitWebSocketAdapter.OnRequestGenerated
OnTopicSubscriptionStateChange : Action< PubSubSubscriptionState >
Event callback for subscription state change
Signature
Action<PubSubSubscriptionState> Meta.Voice.Net.WebSockets.WitWebSocketAdapter.OnTopicSubscriptionStateChange

Protected Methods

HandleRequestGenerated ( topicId , request )
Signature
virtual void Meta.Voice.Net.WebSockets.WitWebSocketAdapter.HandleRequestGenerated(string topicId, IWitWebSocketRequest request)
Parameters
topicId: string
Returns
void
HandleSubscriptionStateChange ( topicId , subscriptionState )
Handle currently set topic id subscription changes only
Signature
virtual void Meta.Voice.Net.WebSockets.WitWebSocketAdapter.HandleSubscriptionStateChange(string topicId, PubSubSubscriptionState subscriptionState)
Parameters
topicId: string
subscriptionState: PubSubSubscriptionState
Returns
void
OnDestroy ()
Signature
virtual void Meta.Voice.Net.WebSockets.WitWebSocketAdapter.OnDestroy()
Returns
void
OnDisable ()
Signature
virtual void Meta.Voice.Net.WebSockets.WitWebSocketAdapter.OnDisable()
Returns
void
OnEnable ()
Signature
virtual void Meta.Voice.Net.WebSockets.WitWebSocketAdapter.OnEnable()
Returns
void
SetSubscriptionState ( subscriptionState )
Set the current subscription state
Signature
void Meta.Voice.Net.WebSockets.WitWebSocketAdapter.SetSubscriptionState(PubSubSubscriptionState subscriptionState)
Parameters
subscriptionState: PubSubSubscriptionState
Returns
void

Methods

SendRequest ( request )
Send a request with a specified topic
Signature
void Meta.Voice.Net.WebSockets.WitWebSocketAdapter.SendRequest(IWitWebSocketRequest request)
Parameters
Returns
void
SetClientProvider ( clientProvider )
Safely sets the new web socket client provider if possible
Signature
void Meta.Voice.Net.WebSockets.WitWebSocketAdapter.SetClientProvider(IWitWebSocketClientProvider clientProvider)
Parameters
Returns
void
SetTopicId ( newTopicId )
Set the topic, unsubscribe to the previous & subscribe to a new
Signature
void Meta.Voice.Net.WebSockets.WitWebSocketAdapter.SetTopicId(string newTopicId)
Parameters
newTopicId: string
Returns
void