Class: DataFlowService

DataFlowService

数据流服务类。用于实现客户端与服务器之间实现低延迟和实时数据传输。数据流服务采用 WebSocket 协议,支持全双工、双向式通信。 服务器可将流数据服务的分析处理结果作为数据来源向客户端广播,客户端与数据流服务建立连接后,即可自动接收服务器广播的数据。

new DataFlowService(url, options)

Usage
import { DataFlowService } from '@supermapgis/iclient-mapboxgl';

new DataFlowService(url, options);
<script type="text/javascript" src="https://iclient.supermap.io/dist/mapboxgl/iclient-mapboxgl.js"></script>
<script>
  new mapboxgl.supermap.DataFlowService({paramsNames});
</script>
mapboxgl/services/DataFlowService.js, line 7
Name Type Description
url string

数据流服务地址,如 ws://{ip}:{port}/iserver/services/dataflowTest/dataflow 。

options Object

参数。

Name Type Description
geometry GeoJSONObject 可选

空间范围,只有在该范围内的要素才能被接收。

excludeField Object 可选

过滤字段。传入此参数,接收到的信息将不包含过滤掉的字段。

crossOrigin boolean 可选

是否允许跨域请求。

headers Object 可选

请求头。

Fires
Example
new DataFlowService(url)
 .queryChart(param,function(result){
    //doSomething
})

API Relations

Returned by: DataFlowService.initBroadcast.

Extends

DataFlowService -> ServiceBase

Events

broadcastFailed

mapboxgl/services/DataFlowService.js, line 52

广播失败。

broadcastSocketConnected

mapboxgl/services/DataFlowService.js, line 44

broadcast Socket 连接成功。

broadcastSocketError

mapboxgl/services/DataFlowService.js, line 48

broadcast Socket 连接失败。

broadcastSucceeded

mapboxgl/services/DataFlowService.js, line 56

广播成功。

inherited initialized

mapboxgl/services/ServiceBase.js, line 32

构造函数构造成功之后触发。

Properties:
Name Type Description
this Object

this 对象。

messageSucceeded

mapboxgl/services/DataFlowService.js, line 68

获取信息成功。

setFilterParamSucceeded

mapboxgl/services/DataFlowService.js, line 72

设置过滤参数成功。

subscribeSocketConnected

mapboxgl/services/DataFlowService.js, line 60

订阅数据连接成功。

subscribeSocketError

mapboxgl/services/DataFlowService.js, line 64

订阅数据连接失败。

subscribesucceeded

mapboxgl/services/DataFlowService.js, line 90

数据流服务订阅成功后触发。

Properties:
Name Type Description
e Object

事件对象。

Methods

broadcast(obj)

mapboxgl/services/DataFlowService.js, line 111

加载广播数据。

Name Type Description
obj JSONObject

要素数据。

initBroadcast(){DataFlowService}

mapboxgl/services/DataFlowService.js, line 101

初始化广播。

Returns:
Type Description
DataFlowService
  • 数据流服务。

initSubscribe()

mapboxgl/services/DataFlowService.js, line 120

初始化订阅数据。

setExcludeField(excludeField)

mapboxgl/services/DataFlowService.js, line 130

设置过滤字段。传入此参数,接收到的信息将不包含过滤掉的字段。

Name Type Description
excludeField Object

过滤字段。

setGeometry(geometry)

mapboxgl/services/DataFlowService.js, line 141

空间范围,只有在该范围内的要素才能被接收。

Name Type Description
geometry GeoJSONObject

空间范围。

unBroadcast()

mapboxgl/services/DataFlowService.js, line 160

结束加载广播。

unSubscribe()

mapboxgl/services/DataFlowService.js, line 152

结束订阅数据。