Giter Site home page Giter Site logo

arcgis_websocket_server's Introduction

ArcGIS WebSocket Server

This node server behaves as a GeoEvent StreamServer layer, so it will emit geographic features in the Esri JSON format though a WebSocket. This way we will be able to display a real time layer in ArcGIS without an ArcGIS Enterprise stack.

custom websocket server in arcgis

It can be used with any ArcGIS developer technology or any other product. For example add the StreamServer to a webmap and visualize it in Operations Dashboard, ArcGIS Pro, any Storymap, etc.

Start the app

We are assuming you are familiar with NodeJS, if you are not please read this first

  1. Check init.js and fill in SERVICE_CONF object properly.
const SERVICE_CONF = {
  name : "twitter",
  out_sr : {
    wkid : 102100,
    latestWkid : 3857
  },
  port : 9000,
  host : process.env["NGROK"]  || "localhost",
  protocol : process.env["NGROK"] ? "https" : "http"
};

Be aware of the name : "twitter". It will be propagated below, in the instructions. If you want to use othe name, change it also along the instructions.

  1. Start the real time server: node init.js "ws://localhost:8888" "4.11"

In this example ws://localhost:8888 is the websocket connection we want to consume data from. This websocket connection it's not the same as the one which will be exposed by StreamServer. But don't worry, all will be wired up (luckily)

It will check the websocket connection first. If it's any problem, it will notice it, and it will warn you :-)

If it's able to connect, it "automagically" set the fields for your StreamServer according to the payload received in the websocket connection attempted before.

  1. Start a web server: cd example & http-server -p 9090
  2. Open: http://localhost:9090/
  3. Stream service url: http://localhost:9000/arcgis/rest/services/twitter/StreamServer

Using HTTPS (NGROK)

If you want to test this from the sandbox sample you can also use ngrok

  1. Run: ngrok http 9000
  2. Stop init.js and run NGROK=yourid.ngrok.io node init.js "ws://localhost:8888" "4.11"
  3. Use: https://yourid.ngrok.io/arcgis/rest/services/twitter/StreamServer instead of http://localhost:9000/arcgis/rest/services/twitter/StreamServer

Known issues

ArcGIS API for JavaScript version <= v4.8 & v3.x

UPDATE : Working in a version which can handle any version! Cross your fingers!

Before this commit on May 5, 2015 this streamserver was only working with JS API <= v4.8 and v3.x. If you want to know more you can also check this issue.

Additional documentation

Talk: Geolocating tweets in real time (in Spanish)

En la charla Geolocalizando tweets en tiempo real del día día 24 de Julio de 2019 se explicó:

A continuación puede encontrar el vídeo en Youtube con un índice interactivo en la descripción del vídeo:

arcgis_websocket_server's People

Contributors

hhkaos avatar ntkog 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.