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

15
Jorge Barrachina Gutiérrez How I Built my Custom Websocket Server with NodeJS

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

Page 1: How I Built my Custom Websocket Server with NodeJS · 2020-01-06 · • Forprototyping, you may not need a StreamServer, just use Websockets • Youhave control over the payload

Jorge Barrachina Gutiérrez

How I Built my Custom Websocket Server with NodeJS

Page 2: How I Built my Custom Websocket Server with NodeJS · 2020-01-06 · • Forprototyping, you may not need a StreamServer, just use Websockets • Youhave control over the payload

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

Page 3: How I Built my Custom Websocket Server with NodeJS · 2020-01-06 · • Forprototyping, you may not need a StreamServer, just use Websockets • Youhave control over the payload

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 ?

Page 4: How I Built my Custom Websocket Server with NodeJS · 2020-01-06 · • Forprototyping, you may not need a StreamServer, just use Websockets • Youhave control over the payload
Page 5: How I Built my Custom Websocket Server with NodeJS · 2020-01-06 · • Forprototyping, you may not need a StreamServer, just use Websockets • Youhave control over the payload

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

Page 6: How I Built my Custom Websocket Server with NodeJS · 2020-01-06 · • Forprototyping, you may not need a StreamServer, just use Websockets • Youhave control over the payload
Page 7: How I Built my Custom Websocket Server with NodeJS · 2020-01-06 · • Forprototyping, you may not need a StreamServer, just use Websockets • Youhave control over the payload

Client-Side – Create FeatureLayer

Websocketpayload

Page 8: How I Built my Custom Websocket Server with NodeJS · 2020-01-06 · • Forprototyping, you may not need a StreamServer, just use Websockets • Youhave control over the payload

Client-Side – Receiving Data

Page 9: How I Built my Custom Websocket Server with NodeJS · 2020-01-06 · • Forprototyping, you may not need a StreamServer, just use Websockets • Youhave control over the payload

Client-Side – Update FeatureLayer

Page 10: How I Built my Custom Websocket Server with NodeJS · 2020-01-06 · • Forprototyping, you may not need a StreamServer, just use Websockets • Youhave control over the payload

”Custom” StreamServerDEMO

Page 11: How I Built my Custom Websocket Server with NodeJS · 2020-01-06 · • Forprototyping, you may not need a StreamServer, just use Websockets • Youhave control over the payload

”Custom” StreamServerShow me the code!

Github repo

Tip: you don’t have to publish on NPM

Page 12: How I Built my Custom Websocket Server with NodeJS · 2020-01-06 · • Forprototyping, you may not need a StreamServer, just use Websockets • Youhave control over the payload

StreamServer vs plain Websocket ServerPros & cons

Page 13: How I Built my Custom Websocket Server with NodeJS · 2020-01-06 · • Forprototyping, you may not need a StreamServer, just use Websockets • Youhave control over the payload

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”

Page 14: How I Built my Custom Websocket Server with NodeJS · 2020-01-06 · • Forprototyping, you may not need a StreamServer, just use Websockets • Youhave control over the payload

Future enhancementsThings in my head :-)

Page 15: How I Built my Custom Websocket Server with NodeJS · 2020-01-06 · • Forprototyping, you may not need a StreamServer, just use Websockets • Youhave control over the payload

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