Skip to content

Remote Push API Wrapper

Julien Eberle edited this page Oct 14, 2016 · 2 revisions

Remote Push API wrapper

This wrapper listen on a tcp zeromq socket and waits for the local gsn-services API to receive data and to forward them to it. On the opposite to the REST API remote wrapper, this one is useful when the data destination has a fixed public IP address, but not the data source (for example a smart device's sensor behind a NAT or a mobile phone) and the communication needs to go over internet (and can be encapsulated by TLS/SSL). Authentication of the remote device that is pushing the data can use any of the available oauth2 mechanisms on the gsn-services.

To allow the virtual sensor to provision the database table, you must specify the data fields in the wrapper.

For example the following stream is defined to listen on the local port 22050 for incoming stream-elements. The IP of the machine running gsn-core from the point of view of the gsn-services is 192.168.1.101 (it can also be 127.0.0.1 if they are on the same machine).

<streams>
	<stream name="input1">
		<source alias="source1" sampling-rate="1" storage-size="1">
			<address wrapper="remote-api">
				<predicate key="local_address">tcp://192.168.1.101/</predicate>
				<predicate key="local_port">22050</predicate>
			</address>
			<output-structure>
				<field name="temp" type="double" unit="degree Celsius"/>
			</output-structure>
			<query>select * from wrapper</query>
		</source>
		<query>select * from source1</query>
	</stream>
</streams>
Clone this wiki locally