Skip to content
This repository has been archived by the owner on Jan 25, 2022. It is now read-only.
/ coset Public archive

communication socket by using websocket and webrtc data channel

License

Notifications You must be signed in to change notification settings

Dreaded-Gnu/coset

Repository files navigation

coset

coset ( COmmunication sockET ) is a communication library for client server applications using WebRTC DataChannels.

Note: Project is currently in an very early state of development and not yet published to npm.

GitHub license lerna code style: prettier

Description

WebRTC DataChannel connections are made by using internal websocket signaling server. So the client has to support normal websockets and also WebRTC DataChannels when you're going to use this library.

Installation

npm install @coset/server --save

How to use

For WebRTC especially DataChannels an SSL encryption is enforced, so you're going to need an https server. For usage examples have a look at the example directory.

ToDo

  • Add heartbeat to server with disconnect on no in-time answer
    • Extend server config by attribute server restricted to https server
    • Extend server config by ping timeout attribute as number with default of 10 seconds
    • Remove not yet used config options from server config interface
    • Split up transport into classes for webrtc and websocket
    • Use event bus for connecting websocket and webrtc transport layer instead of passing them around
    • Check and add ping ( server -> client -> server ) to WebSocket transport layer
    • Check and add ping ( server -> client -> server ) to RtcDataChannel transport layer
    • Add disconnect of both transports when one or both disconnected or emitted an error
    • Add disconnect with emit of disconnect event when ping doesn't receive an answer within set timeframe.
    • Test heartbeat with disconnect on timeout
    • Find better place for SocketClose callback within webrtc
  • Add verbose output activated, when setting specific environment variable by using debug
  • Encoding/Decoding of packages with registering serialization schemes and handler
    • Change data transfer for rtc to binary by using arraybuffer

    • Add attach of listener for packet type with included message structure ( first parameter type, second callback, 3rd message structure ) used for send and receive

      /*
       * handler will be used for encode of data
       * before send and decode of data after receive
       * before passing data out
       */
      client.Serialize(
        Message.Position, {
          a: Type.Char,
          b: Type.Int,
          c: Type.Short,
          d: Type.Float,
        }
      );
      
      /*
       * handler called after decode has been done
       */
      client.Handler(
        Message.Position,
        ( data ) => {
          /* ... do something with data structure ... */
        }
      );
    • Support (de-)serialization of data as common helper

      • Implement encoding of data before send, when scheme is set.
      • Implement decoding of data after receive, when scheme is set.
      • Consider following scheme types signed and unsigned
        • Byte: 1 byte
        • UByte: 1 byte
        • ShortInt: 2 byte
        • UShortInt: 2 byte
        • Int: 4 bytes
        • UInt: 4 bytes
        • Float: 4 bytes
        • Double: 8 bytes
    • Catch errors that may occur, during send/receive and emit errors

    • Test send/receive of messages with and without data

  • Add message queue for enqueing messages before sending it and to not overload datachannel
  • Implement kind of protocol on top of rtc
    • Support packet fragmentation
    • Support message chunking
    • Support reliable-ordered messages
  • Add client library
    • Create bare client package
    • Move client and server used parts from server to common package
  • Move project to created organization
  • Add prettier
    • Include prettier within tslint for packages
    • Add and include prettier to eslint for plain javascript examples
    • Add and include prettier to tslint for typescript examples
  • Add automatic documentation generation
  • Add automatic changelog generation
  • Add code of conduct file
  • Add content within contributing markdown
  • Add github issue and pull request templates
  • Publish to npm
  • Further ehancements after first release
    • Manage signal and webrtc transport a bit less nasty
    • Add reconnection strategy
    • Add pub sub pattern with rooms/namespaces
  • Ongoing enhancements before and during releases
    • Documentation
      • Create/Enhance documentation
      • Create wiki documentation
      • Create project website using github pages
    • Examples
      • Create javascript examples
      • Create typescript examples
    • Improve testing
      • Add unit testing at server and client
      • Add end to end tests using node server and browser
      • Add ci test suite for executing unit tests and browser based tests
        • OS X
        • Linux
        • Windows
      • Add greenkeeper for dependency management (ci integration needed)

About

communication socket by using websocket and webrtc data channel

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published