Giter Site home page Giter Site logo

deepstream.io-client-specs's Introduction

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.

deepstream.io-client-specs's People

Contributors

greenkeeperio-bot avatar jdmnd avatar julietmatsai avatar schulz3000 avatar timaschew avatar wolframhempel avatar yasserf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

deepstream.io-client-specs's Issues

"Feature file already contains a scenario with name" Error

I got the error "Feature file already contains a scenario with name" for a lot of scenarios when using specflow and Visual Studio with provided feature files.

Steps to reproduce:

  • Install specflow Visual Studio integration like described on specflow.org -> Get started
  • create new UnitTest project
  • add SpecFlow package from nuget
  • add connecting.feature file from this repo
  • generate step definitions like described on specflow.org -> Get started
  • build project and run tests
    Result: project is building and tests running with warning because they are not implemented right now.
  • adding the rest of the feature files from this repo and generate step positions for them
  • build project
    Result: described errors appear

deepstream_specflow_duplicated_scenario

/cc @yasserf

Expand merge conflict resolution tests

Merge conflict test requires tests to:

  1. Ensure that the correct arguments are being passed from the server to the conflict resolution.
  2. Throw errors if conflict resolution fails.

Scenarios are not self-contained

Running individual scenarios should yield the same result as when running a complete feature. Similar to tests, scenarios should be self-contained and should not depend on other scenarios being executed previously. Currently, that's not the case.

For example, when executing the complete logging-in feature, everything passes:
nodejs ./node_modules/cucumber/bin/cucumber.js --require ./step-definitions-server/step-definition-server.js --require ./step-definitions-client/ ./features/logging-in.feature

However, when only one scenario is executed, it fails:
nodejs ./node_modules/cucumber/bin/cucumber.js --require ./step-definitions-server/step-definition-server.js --require ./step-definitions-client/ ./features/logging-in.feature --name "too many"

For steps that should be executed before every scenario in a feature, perhaps adding a Background would be a good idea. A specific example would be adding this to logging-in.feature:

Background:
    Given the test server is ready
        And the client is initialised

This means that the server and client need to be torn down after each scenario.

There are some cases that cannot be solved by adding a background, like the TOO_MANY_AUTH_ATTEMPTS one, where the solutions is to simply add more steps that describe the scenario completely.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.