How I Built my Custom Websocket Server with NodeJS · 2020-01-06 · • Forprototyping, you may...

Post on 30-Jun-2020

6 views 0 download

Transcript of How I Built my Custom Websocket Server with NodeJS · 2020-01-06 · • Forprototyping, you may...

Jorge Barrachina Gutiérrez

How I Built my Custom Websocket Server with NodeJS

Agenda

1. Websockets – Just a little bit of context

2. Demo – Málaga bus network

3. ”Custom” StreamServer - Demo

4. ”Custom” StreamServer – Show me the code!

• Endpoints• On-the-fly setup• Testing: AGOL & Javascript API

5. StreamServer vs plain Websocket Server

6. Future enhancements

WebsocketsJust a little bit of context

• bi-directional low-latency channel between browser and server

• Websocket vs SSE (Server Sent Events)

• When shoud I use websockets ?

Málaga Bus network DemoMálaga Open Data (Geojson updated every minute)

Client-Side – Create FeatureLayer

Websocketpayload

Client-Side – Receiving Data

Client-Side – Update FeatureLayer

”Custom” StreamServerDEMO

”Custom” StreamServerShow me the code!

Github repo

Tip: you don’t have to publish on NPM

StreamServer vs plain Websocket ServerPros & cons

Considerations

• Everything it’s a tradeoff

• Budget / Time / Customization

• Developer Team

• For prototyping, you may not need a StreamServer, just use Websockets

• You have control over the payload ( You can streams arrays, less overhead)

• If you want an Out-of-the-box solution, use GeoEvent Server)

• If you want to have fine-grain control about custom StreamServer, you have to “get your

hands dirty”

Future enhancementsThings in my head :-)

Complete answersand select “Submit”

Scroll down to find the feedback section

Select the session you attended

Download the Esri Events app and find your event

Please Take Our Survey on the App