17 "yarp.carrier.websocket",
45 if (header.
length() != header_lenght) {
48 const char* target =
"GET /?ws";
49 for (
size_t i = 0; i < header_lenght; i++) {
50 if (header.
get()[i] != target[i]) {
61 const char* target =
"GET /?ws";
62 if (header.
length() == 8) {
63 for (
int i = 0; i < 8; i++) {
64 header.
get()[i] = target[i];
136 auto messagetype = messageHandler.parseHandshake(
reinterpret_cast<unsigned char*
>(
const_cast<char*
>(result.c_str())), result.size());
137 if (
messagetype != WebSocketFrameType::OPENING_FRAME) {
182 std::string
reply = messageHandler.answerHandshake();
const yarp::os::LogComponent & WEBSOCKETCARRIER()
bool expectReplyToHeader(ConnectionState &proto) override
Process reply to header, if one is expected for this carrier.
bool expectAck(ConnectionState &proto) override
Receive an acknowledgement, if expected for this carrier.
bool expectIndex(ConnectionState &proto) override
Expect a message header, if there is one for this carrier.
bool expectSenderSpecifier(ConnectionState &proto) override
Expect the name of the sending port.
Carrier * create() const override
Factory method.
bool isTextMode() const override
Check if carrier is textual in nature.
void getHeader(Bytes &header) const override
Provide 8 bytes describing this connection sufficiently to allow the other side of a connection to se...
bool sendHeader(ConnectionState &proto) override
Write a header appropriate to the carrier to the connection, followed by any carrier-specific data.
bool canOffer() const override
Check if writing is implemented for this carrier.
std::string getName() const override
Get the name of this connection type ("tcp", "mcast", "shmem", ...)
bool write(ConnectionState &proto, yarp::os::SizedWriter &writer) override
Write a message.
bool sendIndex(ConnectionState &proto, SizedWriter &writer) override
bool sendAck(ConnectionState &proto) override
Send an acknowledgement, if needed for this carrier.
bool checkHeader(const Bytes &header) override
Given the first 8 bytes received on a connection, decide if this is the right carrier type to use for...
bool supportReply() const override
This flag is used by YARP to determine whether the connection can carry RPC traffic,...
bool requireAck() const override
Check if carrier has flow control, requiring sent messages to be acknowledged by recipient.
bool respondToHeader(ConnectionState &proto) override
Respond to the header.
A mini-server for performing network communication in the background.
void write(bool forceStrict=false)
Write the current object being returned by BufferedPort::prepare.
A simple abstraction for a block of bytes.
A base class for connection types (tcp, mcast, shmem, ...) which are called carriers in YARP.
virtual bool reply(ConnectionState &proto, SizedWriter &writer)
The basic state of a connection - route, streams in use, etc.
OutputStream & os()
Shorthand for getOutputStream()
virtual OutputStream & getOutputStream()=0
Access the output stream associated with this connection.
virtual const Route & getRoute() const =0
Get the route associated with this connection.
virtual TwoWayStream * giveStreams()=0
Take ownership of the streams associated with the connection.
InputStream & is()
Shorthand for getInputStream()
virtual void takeStreams(TwoWayStream *streams)=0
Provide streams to be used with the connection.
virtual void setRoute(const Route &route)=0
Set the route associated with this connection.
static LogCallback printCallback()
Get current print callback.
virtual bool isOk() const =0
Check if the stream is ok or in an error state.
Information about a connection between two ports.
void setFromName(const std::string &fromName)
Set the source of the route.
Minimal requirements for an efficient Writer.
virtual void write(OutputStream &os)
#define yCError(component,...)
#define yCTrace(component,...)
#define YARP_LOG_COMPONENT(name,...)
An interface to the operating system, including Port based communication.