Quantcast
Channel: Plantronics Developer Connection: Message List
Viewing all articles
Browse latest Browse all 377

Re: Latency of Events of Javascript Restful API ?

$
0
0

Hi Waqas,

 

The current design of our REST Service API is that the JavaScript client code must regularly poll the REST Service for events.

 

For example, if you look at the code of this sample: "Hello World!" Spokes JavaScript API sample

In the file "helloworld.html" line 253 it specifies 500millisecond polling interval to look for events.

 

That should mean that with a wired product such as Blackwire C510/C520 events take up to 500ms to be received. With a wireless product it can take a bit longer as the messages also have to transmit via Bluetooth or DECT wireless.

 

This regular polling places a small but steady cpu load on the host workstation. If you use a much smaller polling interval, the cpu load increases.

 

A lower-latency alternative to the REST Service polling approach is to create a middleware component in C# that connects to the Plantronics COM Service API and exposes a WebSocket. The JavaScript can then connect to the WebSocket which handles bi-directional communications without the need for polling. We have an example of middleware component that does just that here: Integrating Plantronics Call Control with WebRTC in the component called "PlantronicsWebRTC".

 

Thanks,
Lewis.


Viewing all articles
Browse latest Browse all 377

Trending Articles