Skip to content
This repository has been archived by the owner on Apr 6, 2021. It is now read-only.

C Client Proposal

Yasser Fadl edited this page Feb 16, 2017 · 1 revision

C++ Client Proposal

This software uses POCO C++ libraries.

Requirements

The deepstream C++ client shall

  • be licensed under the Apache License, Version 2.0,
  • provide a C interface,
  • work on POSIX-compliant systems,
  • work on multiple architectures including x86, x86-64, and ARMv7,
  • support unicode (UTF-8),
  • implement a deepstream message parser,
  • implement a deepstream client state machine,
  • implement deepstream authentication,
  • implement deepstream ping-pong messages,
  • implement deepstream events before records and remote procedure calls (RPCs),
  • use an existing websockets implementation,
  • separate message parser and state machine from the websockets implementation and timer mechanism,
  • provide a default timer mechanism,
  • contain a demo program (connect with server, log in, receive event),
  • use a popular build system,
  • provide automated tests,
  • provide documentation,
  • provide an API making the deepstream.io client API accessible,
  • allow single-threaded and multithreaded use,
  • allow synchronous (polling) and asychronous use,
  • provide continuous integration setups for Linux, MacOS, and Windows,
  • pass the Cucumber client specs tests,
  • pass the deepstream E2E tests tests after the client specs,
  • emulate JavaScript API or Java API: `client.event.emit('identifier', optional_payload);

Guidelines

  • The implementation has tightly bounded memory consumption.
  • C++14 should be avoided if possible.
  • Build times are kept short.

Implementation Proposal

The deepstream C++ client

  • will be implemented in C++11 as far as possible,
  • provides a timer mechanism using timer_create(),
  • uses CMake as build system,
  • provides unit tests using Boost.Test,
  • is tested with Valgrind,
  • will be developed with the aid of a static analyzer,
  • provides high-level documentation on deepstream.io if necessary,
  • provides source-level doumentation with Doxygen,
  • will decide later on a JSON parser.

Schedule

Implementing implies static analysis and testing on at least one platform. Testing includes unit tests but not necessarily Cucumber tests.

  • Implement parser
  • Implement state machine
  • Integrate websockets functionality
  • Implement default timer mechanism
  • Implement deepstream connect
  • Implement deepstream heartbeat
  • Pass Cucumber login tests
  • Implement deepstream events
  • Pass Cucumber event tests
  • Start testing on multiple platforms the latest here
  • Test performance
  • Integrate JSON functionality
  • Test unicode functionality
  • Implement deepstream records
  • Pass Cucuber record tests
  • Implement deepstream RPCs
  • Pass Cucumber RPC tests
  • Implement deepstream presence feature
  • Pass Cucumber presence tests

Relevant Links

deepstream

Static Analysis Links

JSON Parsers

Consider JSON paths support.

  • Jansson
    • full Unicode support (UTF-8)
    • MIT license
    • last commit: Oct 2016
  • POCO
    • Boost software license
    • last commit: Dec 2016
  • taocpp/JSON
    • fully standards compliant (100% in Native JSON Benchmark)
    • header only
    • MIT license
    • last commit: Dec 2016
  • RapidJSON
    • object-oriented: Document d; d.Parse(json);
    • header only
    • MIT license(?)
    • last commit: Dec 2016
  • jsmn
    • deserialize only
  • cJSON
    • 2300 LOC C89
  • JSON-C
    • MIT license
  • NXJSON
    • non-validating
  • yajl
    • "event-driven (SAX-style)"
    • object-oriented C, stream parsing,
    • ISC license

WebSocket Libraries

GitHub statistics as of Jan 17, 2017.

  • Beast HTTP/WebSocket
    • depends on boost>=1.58
    • uses Boost.Asio
    • header only
    • GitHub: 54 watchers, 265 stars, 52 forks
    • Boost license
  • Boost.Asio
    • general network programming
    • Boost license
  • libwebsockets
    • C
    • RFC 7692 support (Compression Extensions for WebSockets)
    • GitHub: 147 watchers, 982 stars, 436 forks
    • LGPL 2.1
  • noPoll
    • LGPL 2.1
  • POCO WebSockets
    • GitHub: 275 watchers, 1841 stars, 701 forks
    • Boost license
  • WebSocket++
    • uses C++11 or Boost.Asio
    • header only
    • GitHub: 207 watchers, 1564 stars, 559 forks
    • "full RFC6455 support"
    • 3-clause BSD license

Testing