Streaming Events
The Lookout Mobile Risk API version 2 uses Server-Sent Events’ (SSE) protocol to push data to clients that ‘subscribe’ to the /events
endpoint. The publishing model formats Lookout data in the Event stream as described by the server-sent events protocol.
Server Sent Events are useful in our case because the listener opens a unidirectional channel that does not require any client resources other than listening for events and handling them as they arrive
To subscribe to an event stream, create an EventSource object and pass it the URL of your stream:
} |
If the URL passed to the EventSource constructor is an absolute URL, its origin (scheme, domain, port) must match that of the calling page.