Skip to content
This repository has been archived by the owner on Feb 8, 2020. It is now read-only.

A suite of Gherkin files to test protocol support by clients

License

Notifications You must be signed in to change notification settings

deepstreamIO/deepstream.io-client-specs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

96 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Message Structure Overview

deepstream messages are transmitted using a proprietary, minimal, string-based protocol. Every message follows the same structure:

<topic>|<action>|<data[0]>|...|<data[n]>+

| and + are used in these examples as placeholders, messages are actually separated by invisible Ascii control characters ("unit separator" (31) and "record separator" (30))

Every message has a topic (e.g. RECORD, EVENT, AUTH etc.) and an action ( CREATE, DELETE, SUBSCRIBE etc.). For a full list of available topics and actions please see the list of constants here.

Example

Here's an example: creating or reading a record user/Lisa

userLisa = ds.record.getRecord( 'user/Lisa' );

would prompt the client to send this message to the server

Messages always start with topic and action, but can contain an arbitrary amount of data fields afterwards.

Setting the value of a path within the record for example

userLisa.set( 'lastname', 'Owen' );

would result in this outgoing message

Please note the additional S before Owen. This indicates that the remaining part of the message should be treated as a string. Please find a list of available types here.

Both client and server use a message-parser to validate these messages and to convert them into objects looking like this:

{
	raw: 'R\u001fP\u001fuser/Lisa\u001f1\u001flastname\u001fSOwen',
	topic: 'R',
	action: 'P',
	data: [ 'user/Lisa', '1', 'lastname', 'SOwen' ]
}

The actual conversion of SOwen into Owen happens further down the line by the part of the application that handles this specific message and knows which fields contain typed data.

About

A suite of Gherkin files to test protocol support by clients

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published