Module socketio

Summary

Members Descriptions
namespacescy::sockio

namespace scy::sockio

Summary

Members Descriptions
classscy::sockio::Client
classscy::sockio::Packet
classscy::sockio::SSLClient
classscy::sockio::TCPClient
structscy::sockio::ClientState
structscy::sockio::Transaction

class scy::sockio::Client

class scy::sockio::Client
  : public scy::Stateful< ClientState >
  : public scy::net::SocketAdapter
  : public scy::SignalBase< PacketDelegateBase, IPacket & >

Summary

Members Descriptions
public Client(const net::Socket::Ptr & socket,constOptions& options) Client(const net::Socket::Ptr& socket);.
public virtual ~Client()
public virtual void connect() virtual void connect(const std::string& host, std::uint16_t port);
public virtual void close()
public virtual int send(const std::string & message,bool ack) Send a default message packet.
public virtual int send(const json::Value & message,bool ack)
public virtual int send(const std::string & event,const char * message,bool ack) Send an event packet.
public virtual int send(const std::string & event,const std::string & message,bool ack)
public virtual int send(const std::string & event,const json::Value & message,bool ack)
public virtual int send(constsockio::Packet& packet) Send the given packet.
publicTransaction* createTransaction(constsockio::Packet& request,long timeout) Create a packet transaction.
publicClient::Options& options() Return a reference to the client options object.
publichttp::ws::WebSocket& ws() Return the underlying WebSocket instance.
public std::string sessionID() const Return the current session ID assigned by the server.
publicscy::Errorerror() const Return the error object (if any).
public bool isOnline() const Return true if the client is is Online state.
public bool reconnecting() const Return true if currently reconnecting.
public bool wasOnline() const
public inline virtual const char * className() const
protectedTimer_pingTimer
protectedTimer_pingTimeoutTimer
protectedTimer_reconnectTimer
protectedscy::Error_error
protected std::string _sessionID
protectedClient::Options_options
protectedhttp::ws::WebSocket_ws
protected int _pingTimeout
protected int _pingInterval
protected bool _reconnecting
protected bool _wasOnline
protected virtual void setError(constscy::Error& error)
protected virtual void reset() Reset variables and timers at the beginning and end of each session.
protected virtual void onConnect()
protected virtual void onOnline()
protected virtual void onClose()
protected virtual void onPacket(sockio::Packet& packet)
protected virtual void onHandshake(sockio::Packet& packet)
protected virtual void onMessage(sockio::Packet& packet)
protected virtual void onSocketConnect()
protected virtual void onSocketRecv(constMutableBuffer& buffer,constnet::Address& peerAddress)
protected virtual void onSocketError(constscy::Error& error)
protected virtual void onSocketClose()
protected virtual void onPingTimer()
protected virtual void onPingTimeoutTimer()
protected virtual void startReconnectTimer()
protected virtual void stopReconnectTimer()
protected virtual void onReconnectTimer()
protected virtual int sendPing()
protected virtual void onPong()

Members

public Client(const net::Socket::Ptr & socket,constOptions& options)

Client(const net::Socket::Ptr& socket);.

public virtual ~Client()

public virtual void connect()

virtual void connect(const std::string& host, std::uint16_t port);

public virtual void close()

public virtual int send(const std::string & message,bool ack)

Send a default message packet.

public virtual int send(const json::Value & message,bool ack)

public virtual int send(const std::string & event,const char * message,bool ack)

Send an event packet.

public virtual int send(const std::string & event,const std::string & message,bool ack)

public virtual int send(const std::string & event,const json::Value & message,bool ack)

public virtual int send(constsockio::Packet& packet)

Send the given packet.

publicTransaction* createTransaction(constsockio::Packet& request,long timeout)

Create a packet transaction.

publicClient::Options& options()

Return a reference to the client options object.

publichttp::ws::WebSocket& ws()

Return the underlying WebSocket instance.

public std::string sessionID() const

Return the current session ID assigned by the server.

publicscy::Errorerror() const

Return the error object (if any).

public bool isOnline() const

Return true if the client is is Online state.

public bool reconnecting() const

Return true if currently reconnecting.

public bool wasOnline() const

Return true if the client was previously in the Online state. Useful for delegates handling the Error state.

public inline virtual const char * className() const

protectedTimer_pingTimer

protectedTimer_pingTimeoutTimer

protectedTimer_reconnectTimer

protectedscy::Error_error

protected std::string _sessionID

protectedClient::Options_options

protectedhttp::ws::WebSocket_ws

protected int _pingTimeout

protected int _pingInterval

protected bool _reconnecting

protected bool _wasOnline

protected virtual void setError(constscy::Error& error)

protected virtual void reset()

Reset variables and timers at the beginning and end of each session.

protected virtual void onConnect()

protected virtual void onOnline()

protected virtual void onClose()

protected virtual void onPacket(sockio::Packet& packet)

protected virtual void onHandshake(sockio::Packet& packet)

protected virtual void onMessage(sockio::Packet& packet)

protected virtual void onSocketConnect()

These virtual methods can be overridden as necessary to intercept socket events before they hit the application.

protected virtual void onSocketRecv(constMutableBuffer& buffer,constnet::Address& peerAddress)

protected virtual void onSocketError(constscy::Error& error)

protected virtual void onSocketClose()

protected virtual void onPingTimer()

protected virtual void onPingTimeoutTimer()

protected virtual void startReconnectTimer()

protected virtual void stopReconnectTimer()

protected virtual void onReconnectTimer()

protected virtual int sendPing()

protected virtual void onPong()

class scy::sockio::Packet

class scy::sockio::Packet
  : public scy::IPacket

Summary

Members Descriptions
public Packet(Frame frame,Type type,int id,const std::string & nsp,const std::string & event,const std::string & message,bool ack) Default contructor.
public Packet(Type type,const std::string & message,bool ack) General contructor.
public Packet(const std::string & message,bool ack) Message contructor.
public Packet(const json::Value & message,bool ack) JSON contructor.
public Packet(const std::string & event,const std::string & message,bool ack) Event contructor.
public Packet(const std::string & event,const json::Value & message,bool ack) Event JSON contructor.
public Packet(constPacket& r)
publicPacket& operator=(constPacket& r)
public virtual ~Packet()
public virtualIPacket* clone() const
public Frame frame() const
public Type type() const
public int id() const
public std::string nsp() const
public std::string message() const
public json::Value json() const
public void setID(int id)
public void setNamespace(const std::string & nsp)
public void setMessage(const std::string & message)
public void setAck(bool flag)
public virtual std::size_t read(constConstBuffer&)
public virtual void write(Buffer &) const
public virtual std::size_t size() const
public bool valid() const
public std::string frameString() const
public std::string typeString() const
public std::string toString() const
public virtual void print(std::ostream & os) const
public inline virtual const char * className() const
protected Frame _frame
protected Type _type
protected int _id
protected std::string _nsp
protected std::string _event
protected std::string _message
protected bool _ack
protected std::size_t _size

Members

public Packet(Frame frame,Type type,int id,const std::string & nsp,const std::string & event,const std::string & message,bool ack)

Default contructor.

public Packet(Type type,const std::string & message,bool ack)

General contructor.

public Packet(const std::string & message,bool ack)

Message contructor.

public Packet(const json::Value & message,bool ack)

JSON contructor.

public Packet(const std::string & event,const std::string & message,bool ack)

Event contructor.

public Packet(const std::string & event,const json::Value & message,bool ack)

Event JSON contructor.

public Packet(constPacket& r)

publicPacket& operator=(constPacket& r)

public virtual ~Packet()

public virtualIPacket* clone() const

public Frame frame() const

public Type type() const

public int id() const

public std::string nsp() const

public std::string message() const

public json::Value json() const

public void setID(int id)

public void setNamespace(const std::string & nsp)

public void setMessage(const std::string & message)

public void setAck(bool flag)

public virtual std::size_t read(constConstBuffer&)

Read/parse to the packet from the given input buffer. The number of bytes read is returned.

public virtual void write(Buffer &) const

Copy/generate to the packet given output buffer. The number of bytes written can be obtained from the buffer.

Todo: It may be prefferable to use our pod types here instead of buffer input, but the current codebase requires that the buffer be dynamically resizable for some protocols...

virtual std::size_t write(MutableBuffer&) const = 0;

public virtual std::size_t size() const

The size of the packet in bytes.

This is the nember of bytes that will be written on a call to write(), but may not be the number of bytes that will be consumed by read().

public bool valid() const

public std::string frameString() const

public std::string typeString() const

public std::string toString() const

public virtual void print(std::ostream & os) const

public inline virtual const char * className() const

protected Frame _frame

protected Type _type

protected int _id

protected std::string _nsp

protected std::string _event

protected std::string _message

protected bool _ack

protected std::size_t _size

class scy::sockio::SSLClient

class scy::sockio::SSLClient
  : public scy::sockio::Client

Summary

Members Descriptions
public SSLClient(constClient::Options& options,uv::Loop * loop)

Members

public SSLClient(constClient::Options& options,uv::Loop * loop)

class scy::sockio::TCPClient

class scy::sockio::TCPClient
  : public scy::sockio::Client

Summary

Members Descriptions
public TCPClient(constClient::Options& options,uv::Loop * loop)

Members

public TCPClient(constClient::Options& options,uv::Loop * loop)

struct scy::sockio::ClientState

struct scy::sockio::ClientState
  : public scy::State

Summary

Members Descriptions
public inline virtual std::string str(unsigned int id) const

Members

public inline virtual std::string str(unsigned int id) const

struct scy::sockio::Transaction

struct scy::sockio::Transaction
  : public scy::PacketTransaction< sockio::Packet >

Summary

Members Descriptions
publicsockio::Client& client
public Transaction(sockio::Client& client,long timeout)
public Transaction(sockio::Client& client,constsockio::Packet& request,long timeout)
public virtual bool send()
public virtual bool checkResponse(constsockio::Packet& packet)
public virtual void onPotentialResponse(void *,sockio::Packet& packet)
public virtual void onResponse() Called when a successful response is received.
public inline virtual const char * className() const
protected virtual ~Transaction()

Members

publicsockio::Client& client

public Transaction(sockio::Client& client,long timeout)

public Transaction(sockio::Client& client,constsockio::Packet& request,long timeout)

public virtual bool send()

Starts the transaction timer and sends the request. Overriding classes should implement send logic here.

public virtual bool checkResponse(constsockio::Packet& packet)

Checks a potential response candidate and returns true on successful match.

public virtual void onPotentialResponse(void *,sockio::Packet& packet)

public virtual void onResponse()

Called when a successful response is received.

public inline virtual const char * className() const

protected virtual ~Transaction()

results matching ""

    No results matching ""