Voicenter Events SDK aims to manage API and socket communication with Voicenter APIs and backends.
You can use the SDK to send and receive real-time data from and to voicenter servers.
The Events SDK should be used to communicate with Voicenter servers in order to receive real-time data via sockets. Underneath, the events SDK uses socket.io to send and receive events.
-
Direct Download NUGET:
Download out nuget package:
https://www.nuget.org/packages/VoicenterEventsSDK.NET/1.0.1
-
paket:
> paket add VoicenterEventsSDK.NET --version 1.0.1
-
Package Manager:
PM> Install-Package VoicenterEventsSDK.NET -Version 1.0.1
You can initialize and use it to send and receive events to and from our servers.
- Initialize the constructor with a monitorCode
VoicenterRealtime voicenterRealtime = new VoicenterRealtime(LogLevel.Info);
VoicenterRealtimeListener socket = voicenterRealtime.Token("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx").Init();
This step is important as we have an algorithm that retrieves multiple servers and has a failover mechanism behind it. Skipping this step, will throw error(s) in the subsequent steps.
- Subscribe to all events
socket.OnEvent += (object sender, VoicenterRealtimeResponseArgs e) => { Console.WriteLine(e.Name); };
socket.Listen();
- Subscribe to specific events
socket.OnEvent += (object sender, VoicenterRealtimeResponseArgs e) => {
if(e.Name === EventTypes.AllExtensionsStatus)
{
Console.WriteLine(e.Name);
}
};
- Emit events
socket.UpdateExtensions("1111,2222");
Servers List format
new List<String>() { "https://monitor1.voicenter.co/" }
Emits resync event to resync data.
socket.Resync();
Sets new monitor url. This will trigger an http call to get the socket servers based on the monitor url. Please not that providing an invalid url, will try to revert to the old values. In case that fails, you will have to init the SDK again.
voicenterRealtime.Token("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx").SetMonitorList(new List<String>() { "https://monitor1.voicenter.co/" }).Init();
Log in based on user credentials.
voicenterRealtime.User("Email", "Password").Init();
Log in based on user account credentials.
voicenterRealtime.Account("Username", "Password").Init();
Forcefully Dispose the socket.
socket.Dispose();
Logger.onLog += (object sender, VoicenterRealtimeLogger e) =>
{
Console.WriteLine(e.message);
};
CONNECTED
DISCONNECTED
RECONNECTING
CONNECT_ERROR
loginSuccess
loginStatus
AllExtensionsStatus
ExtensionEvent
QueueEvent
ExtensionsUpdated
QueuesUpdated
keepaliveResponse
TokenRefreshed