Robot Raconteur Core C++ Library
Loading...
Searching...
No Matches
BrowserWebSocketTransport.h
Go to the documentation of this file.
1
23
25#include <boost/shared_array.hpp>
26
27#pragma once
28
29namespace RobotRaconteur
30{
31
32class BrowserWebSocketTransportConnection;
64class BrowserWebSocketTransport : public Transport, public RR_ENABLE_SHARED_FROM_THIS<BrowserWebSocketTransport>
65{
66 public:
67 friend class BrowserWebSocketTransportConnection;
68
69 RR_UNORDERED_MAP<uint32_t, RR_SHARED_PTR<ITransportConnection> > TransportConnections;
70
82 BrowserWebSocketTransport(RR_SHARED_PTR<RobotRaconteurNode> node = RobotRaconteurNode::sp());
83
84 RR_OVIRTUAL ~BrowserWebSocketTransport() RR_OVERRIDE;
85
86 RR_OVIRTUAL bool IsServer() const RR_OVERRIDE;
87 RR_OVIRTUAL bool IsClient() const RR_OVERRIDE;
88
89 virtual int32_t GetDefaultReceiveTimeout();
90 virtual void SetDefaultReceiveTimeout(int32_t milliseconds);
91 virtual int32_t GetDefaultConnectTimeout();
92 virtual void SetDefaultConnectTimeout(int32_t milliseconds);
93
94 RR_OVIRTUAL std::string GetUrlSchemeString() const RR_OVERRIDE;
95
96 RR_OVIRTUAL void SendMessage(const RR_INTRUSIVE_PTR<Message>& m) RR_OVERRIDE;
97
98 RR_OVIRTUAL void AsyncSendMessage(
99 const RR_INTRUSIVE_PTR<Message>& m,
100 const boost::function<void(const RR_SHARED_PTR<RobotRaconteurException>&)>& callback) RR_OVERRIDE;
101
102 RR_OVIRTUAL void AsyncCreateTransportConnection(
103 boost::string_ref url, const RR_SHARED_PTR<Endpoint>& e,
104 boost::function<void(const RR_SHARED_PTR<ITransportConnection>&,
105 const RR_SHARED_PTR<RobotRaconteurException>&)>& callback) RR_OVERRIDE;
106
107 RR_OVIRTUAL RR_SHARED_PTR<ITransportConnection> CreateTransportConnection(
108 boost::string_ref url, const RR_SHARED_PTR<Endpoint>& e) RR_OVERRIDE;
109
110 RR_OVIRTUAL void CloseTransportConnection(const RR_SHARED_PTR<Endpoint>& e) RR_OVERRIDE;
111
112 RR_OVIRTUAL bool CanConnectService(boost::string_ref url) RR_OVERRIDE;
113
114 RR_OVIRTUAL void Close() RR_OVERRIDE;
115
116 RR_OVIRTUAL void CheckConnection(uint32_t endpoint) RR_OVERRIDE;
117
118 RR_OVIRTUAL void PeriodicCleanupTask() RR_OVERRIDE;
119
120 RR_OVIRTUAL uint32_t TransportCapability(boost::string_ref name) RR_OVERRIDE;
121
122 RR_OVIRTUAL void MessageReceived(const RR_INTRUSIVE_PTR<Message>& m) RR_OVERRIDE;
123
134 virtual int32_t GetDefaultHeartbeatPeriod();
145 virtual void SetDefaultHeartbeatPeriod(int32_t milliseconds);
146
157 virtual bool GetDisableMessage4();
167 virtual void SetDisableMessage4(bool d);
168
180 virtual bool GetDisableStringTable();
191 virtual void SetDisableStringTable(bool d);
192
219 virtual void SetDisableAsyncMessageIO(bool d);
220
228 virtual int32_t GetMaxMessageSize();
236 virtual void SetMaxMessageSize(int32_t size);
237
238 RR_OVIRTUAL std::vector<std::string> GetServerListenUrls() RR_OVERRIDE;
239
240 protected:
241 virtual void register_transport(RR_SHARED_PTR<ITransportConnection> connection);
242 virtual void erase_transport(RR_SHARED_PTR<ITransportConnection> connection);
243
244 bool closed;
245 int32_t heartbeat_period;
246 int32_t default_connect_timeout;
247 int32_t default_receive_timeout;
248 bool disable_message4;
249 bool disable_string_table;
250 bool disable_async_message_io;
251 int32_t max_message_size;
252};
253} // namespace RobotRaconteur
virtual bool GetDisableStringTable()
Get disable string table.
virtual void SetDisableAsyncMessageIO(bool d)
Set if async message io is disabled.
BrowserWebSocketTransport(boost::shared_ptr< RobotRaconteurNode > node=RobotRaconteurNode::sp())
Construct a new BrowserWebSocketTransport.
virtual void SetDefaultHeartbeatPeriod(int32_t milliseconds)
Set the default heartbeat period.
virtual void SetDisableMessage4(bool d)
Set disable Message Format Version 4.
virtual int32_t GetDefaultHeartbeatPeriod()
Get the default heartbeat period.
virtual int32_t GetMaxMessageSize()
Get the maximum serialized message size.
virtual bool GetDisableMessage4()
Get disable Message Format Version 4.
virtual void SetMaxMessageSize(int32_t size)
Set the maximum serialized message size.
virtual void SetDisableStringTable(bool d)
Set disable string table.
virtual bool GetDisableAsyncMessageIO()
Get if async message io is disabled.
Base class for Robot Raconteur exceptions.
Definition Error.h:53
static boost::shared_ptr< RobotRaconteurNode > sp()
Singleton shared_ptr accessor.