Skip to content

Dev_Protocols

Martin Bischoff edited this page Jul 23, 2018 · 2 revisions

RosBridgeClient Protocols

RosBridgeClient is designed to keep the communication protocol generic. New protocols can be added by implementing a simple and minimalistic IProtocol interface:

public interface IProtocol
{
    void Connect();
    void Close();
    bool IsAlive();
    void Send(byte[] data);
    event EventHandler OnReceive;
}

A RosSocket is instantiated by passing in the IProtocol interface implementation that you want to use.

Example:

string uri = "ws://xxx.xxx.xxx.xxx:9090";
RosSocket rosSocket = new RosSocket(new RosBridgeClient.Protocols.WebSocketNetProtocol(uri));

Though ROS# currently comes with two WebSocket-based IProtocol implementations, note that an IProtocol does not necessarily need to be a WebSocket client.

Currently existing IProtocol interface implementations:

A WebSocket client that is based on the .NET ClientWebSocket class.

  • available since .NET Framework 4.5 only
  • requires Windows 8 and above

A wrapper for websocket-sharp.

  • the original WebSocket client used in ROS#
  • requires additional assembly websocket-sharp.dll
  • not compatible with e.g. UWP

Platform Compatibility Overview:

Platform WebSocketNetProtocol WebSocketSharpProtocol
Windows 7 no yes
Windows 8+ yes yes
Ubuntu ? yes
UWP ? no
iOS ? yes

If you tested a protocol on a new platform, and can contribute with new info in above table, please do!


© Siemens AG, 2017-2018 Author: Dr. Martin Bischoff ([email protected])

Clone this wiki locally