cityline-client
v1.0.6-beta
Published
Real-time library for receiving events from Cityline server. Deeply inspired by server sent events but initiated via posts which allow a much bigger state object with state across multiple producers.
Downloads
10
Maintainers
Readme
Cityline-Client
Cityline Client for dotnet core for connecting to a Cityline.Server-instance.
This library (JavaScript) Server side (dotnet)
┌──────────────────────────────┐ ┌──────────────────────────────┐ ┌──────────────────────────────┐
│ │ │ │ │ ├─┐
│ │ │ │ │ │ │
│ Cityline-Client │◀─────▶│ Cityline.Server │─────▶│ ICitylineProducer │ │
│ │ │ │ │ │ │
│ │ │ │ │ │ │
└──────────────────────────────┘ └──────────────────────────────┘ └──┬───────────────────────────┘ │
└─────────────────────────────┘
- raises events - streams data to clients
- get specific frame - calls producers
(for preloading data) - allows state from call to call
- wait for specific set of frames
(app initialization)
Demo
See a demo of the server and javascript client here.
Getting started
To get started create a new instance of the client pointing directly to the servers cityline endpoint:
var client = new CitylineClient("https://my-server/cityline");
You then subscribe to named events (this mirrors the .Name property of each producer)
cityline.addEventListener("ping", (event: CustomEvent<Ping>) => console.log("ping"));