Choosing between REST or WebSockets

This section describes the different types of server APIs and aims at helping you choose the one you need.

REST and WebSockets

REST over HTTP is an unconnected protocol designed to deliver web pages. Each HTTP/REST request implies a new connection that you have to scramble. Creating and scrambling new requests take time. Every time you make a request you have to provide context and configuration information. REST APIs are very easy to integrate and can settle for low quality networks conditions.

WebSockets is a connected mode, allowing you to create a unique scrambled connection, where requests are continuously sent and received. This protocol can be time-saving but requires to be supported by your browser (or programming language used on the client side), as well as a high-speed and very stable network condition.

Choosing the appropriate API

Recognition API could be used in several ways. Depending on what your user writes, you can choose the API you need. WebSockets APIs address the use case where the user edits what he writes or imports. WebSockets are also ideal if you are looking for an immediate feedback. REST address the use case of recognition of an already set of strokes.

Rich editing and interaction as your users write

Every time your user moves the pen up, the coordinate of the strokes he just drew are sent to the server which immediately recognize the content. Gestures are detected immediately. The user input could be updated immediately. WebSocket is the mode you need.

Import of a set of strokes, then live editing

If your user has already written some content in another application and is willing to import it into MyScript world and then manipulate it, the WebSockets API offers a importStrokes API to do so.

Recognition of a set of strokes

If you have already collected the user strokes and want to recognize the digital content, REST is the required mode.

Cloud usage and pricing

Read the dedicated section in your account section.

We use cookies to ensure that we give you the best experience on our website Read the privacy policy