Git Product home page Git Product logo

websocketclient's Introduction

Web Socket Client WAR scaffold

Minimal Maven scaffold for trying out web applications as web socket clients. Based on the Maven Standard Directory Layout

Includes embedded Maven Jetty plugin (hot reload on per default).

Build status: Build Status

Installation

  • Clone this repo
  • mvn clean install

Running

mvn jetty:run

The console log should look something like this.

log example

Application notes

This is a plain JEE7 Web Application. At startup it creates a websocket connection using a ServletContextListener. It passes the class WebSocketClient as ClientEndpoint. The ClientEndpoint handles all incoming events.

Connection sequence

  • As the WAR deploys, a ServletContextListener will be created and invoked
  • The context listener looks for a system 'env' variable and reads the corresponding properties file ('prod' is the default env) from classpath
  • Once the file is read and the container is starting, the listener will connect and send a connection message to the server with some parameters (see below)
  • The event handler is registered by the context listener on the websocket

Connection parameters

Not yet fully implemented.

Once a connection is established, the client will send a message to the server.

The message contains the following parameters

  • id: Just a client id, to have somethig to refer to
  • apiKey: A valid API key. Without this, the client will be ignored by the server
  • msgFilter: key-value pair used to filter messages the client is interested in (no filter = all events)
  • channel: The channel to listen to. Curently only one channel is available. 'clickStream', where all click events are propagated

Replaying old events

Currently not supported.

Will most likely be an event sent by the client requesting replay from a certain timestamp. There will be a special temporary channel for this where the client is the only subscriber. (Suggesting -. Ex: clickStream-id:12345678)

Files

WebSockets?

Some startng points

websocketclient's People

Contributors

aweijnitz avatar

Watchers

 avatar James Cloos avatar  avatar

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.