How to load stream layer on android mobile?

1315
1
Jump to solution
02-16-2017 02:33 AM
LeoDeng
Occasional Contributor II

I've publish the stream service using arcgis geoevent server.

And I've get the stream layer result from arcgis server rest url  (http://192.168.1.107:6080/arcgis/rest/services/GeoEvent/GPSVehicles/StreamServer ).

When I copy the html and javascript from web (REST URL > view in Javascript > view source ) to mobile using cordova, the connect becomes error.

A web socket connection to the stream service running at http://myserver:port/arcgis/rest/services/GeoEvent/GPSVehicles/StreamServer could not be established.

How to develop a map running on mobile with stream layer?

Environment:

ArcGIS Server 10.4.1

ArcGIS GeoEvent 10.4.1

ArcGIS API for JavaScript 3.19 (compact)

Visual Studio 2015 (Tools for Apache Cordova)

Android API (no specify)

0 Kudos
1 Solution

Accepted Solutions
LeoDeng
Occasional Contributor II

Furthermore, on streamLayer "connection-error" event, the error message:

Error: Failed to construct 'WebSocket': Refused to connect to 'ws://leo:6180/arcgis/ws/services/GeoEvent/GPSVehicles/StreamServer/subscribe?outSR=102100' because it violates the document's Content Security Policy.

My Solution:

comment <meta http-equiv="Content-Security-Policy"> in html.

View solution in original post

1 Reply
LeoDeng
Occasional Contributor II

Furthermore, on streamLayer "connection-error" event, the error message:

Error: Failed to construct 'WebSocket': Refused to connect to 'ws://leo:6180/arcgis/ws/services/GeoEvent/GPSVehicles/StreamServer/subscribe?outSR=102100' because it violates the document's Content Security Policy.

My Solution:

comment <meta http-equiv="Content-Security-Policy"> in html.