subscribe


URI

  1. <dataflow_uri>/subscribe[.<format>]

  2. ws://{ip}:{port}/iserver/services/{ServiceName}/dataflow/subscribe

Supported methods

GET, HEAD

Parent resource

dataflow

Introduction

The subcribe resource represents the subscription entry for the data flow service, providing the client with the ability to connect to the data flow service, and the client who subscribes to the data stream service can automatically receive data from the server broadcast.

The client transfers data with the server side by Websocket protocol, where the filtering attributes, dynamic projection parameters can be specified in URI.

Supported Methods:

Supported output formats:rjson, json, html, xml.

Resource hierarchy

HTTP request methods

Implement the HTTP request on the following URI, where supermapiserver is the server name, with rjson being the output format.

http://supermapiserver:8090/iserver/services/{ServiceName}/rest/dataflow/broadcast.rjson

GET request

Gets the subscription entry for the data flow service.

Response structure

Field Type Description
subscribeUrl String URL of the subscription service

Response example

The returned rjson format representation after implementing the GET request on the subscribe resource http://supermapiserver:8090/iserver/services/data/dataflow/subscribe.rjson is as follows:

{"subscribeUrl": "ws://192.168.17.116:8091/iserver/services/data/dataflow/subscribe"}

HEAD request

Asks for the response identical to the one that would correspond to a GET request, but without the response body. This is useful for retrieving meta-information written in response headers, without having to transport the entire content. The meta-information includes the media-type, content-encoding, transfer-encoding, content-length, etc.

The HEAD request can be used to determine whether the subscribe resource exists or whether the client has authority to access the resource. It can quickly determine whether the subscribe resource supports the representation in <format> format by performing HEAD request on URI with <format>.

WebSocket connection

Performs WS request on the following URI, where supermapiserver is the server name.

ws://supermapiserver:8091/iserver/services/{ServiceName}/dataflow/subscribe

Request parameter

 Establish a WebSocket connection, obtain the server broadcast data, you can include the following filter parameters in the URI:

Field Type Description
excludeField String Used to specify filter parameters. This parameter is passed in the request URI, and the information received by the client will not contain the filtered field.
geometry String Specifies the geometric range.
prjCoordSys String Use this parameter to specify the coordinate reference system received by the client.
token String The token required to subscribe to the data flow service. Please see get token.

Request sample

Get the needed information by specifying parameters in URI: ws://supermapiserver:8091/iserver/services/{ServiceName}/dataflow/subscribe?geometry={'bounds':{'bottom':14.0,'center':{'x':20.0,'y':20.0},'height':12.0,'left':14.0,'leftBottom':{'x':14.0,'y':14.0},'right':26.0,'rightTop':{'x':26.0,'y':26.0},'top':26.0,'valid':true,'width':12.0},'center':{'x':20.0,'y':20.0},'id':1,'partTopo':[1],'parts':[4],'points':[{'x':26.0,'y':26.0},{'x':26.0,'y':14.0},{'x':14.0,'y':14.0},{'x':14.0,'y':26.0}],'type':'REGION'}&excludeField=SMSDRIW,SMSDRIN,SMSDRIE,SMSDRIS,SMUSERID,SMAREA,SMPERIMETER,SMGEOMETRYSIZE,SMGEOPOSITION&prjCoordSys={epsg:3857}

It also can pass relevant parameters in WebSocket. When it passes the filtering parameters by WebSocket, it is needed to be included in the filterParam node:

{

    filterParam:

        {

           "excludeField":["SMSDRIW","SMSDRIN","SMSDRIE","SMSDRIS","SMUSERID","SMAREA","SMPERIMETER","SMGEOMETRYSIZE","SMGEOPOSITION"],

           "geometry":

                 {

                   "bounds":

                        {

                           "bottom":-6.0,

                           "center":{"x":0.0,"y":0.0},

                           "height":12.0,

                           "left":-6.0,

                           "leftBottom":

                                  {

                                      "x":-6.0,

                                      "y":-6.0

                                  },

                           "right":6.0,

                           "rightTop":

                                   {

                                       "x":6.0,

                                       "y":6.0

                                    },

                            "top":6.0,

                            "valid":true,

                            "width":12.0

                        },

                            "center":

                                   {

                                      "x":0.0,

                                      "y":0.0

                                   },

                            "id":1,

                            "partTopo":[1],

                            "parts":[4],

                            "points":[{"x":6.0,"y":6.0},{"x":6.0,"y":-6.0},{"x":-6.0,"y":-6.0},{"x":-6.0,"y":6.0}],"type":"REGION"

                 }

         }

}

See