WebRTC support helpers

WebSocketSignaller

[SignallingInterface]({#ref classicy_1_1wrtc_1_1SignallingInterface #}) implementation using plain JSON over WebSocket.

WebSocketSignaller

#include <icy/webrtc/support/wssignaller.h>

Inherits: SignallingInterface

SignallingInterface implementation using plain JSON over WebSocket.

Public Attributes

ReturnNameDescription
Signal< void(const std::string &)>SendMessage

SendMessage

Signal< void(const std::string &)> SendMessage

Public Methods

ReturnNameDescription
WebSocketSignaller explicit
WebSocketSignallerDeleted constructor.
voidsendSdp virtualSend an SDP offer or answer to the remote peer.
voidsendCandidate virtualSend an ICE candidate to the remote peer.
voidsendControl virtualSend a control message to the remote peer.
voidreceive
voidsetLocalPeerId inline
const std::string &localPeerId const inline

WebSocketSignaller

explicit

explicit WebSocketSignaller(const std::string & localPeerId)

WebSocketSignaller

WebSocketSignaller(const WebSocketSignaller &) = delete

Deleted constructor.


sendSdp

virtual

virtual void sendSdp(const std::string & peerId, const std::string & type, const std::string & sdp)

Send an SDP offer or answer to the remote peer.

Parameters

  • peerId Remote peer identifier.

  • type "offer" or "answer".

  • sdp The SDP string.


sendCandidate

virtual

virtual void sendCandidate(const std::string & peerId, const std::string & candidate, const std::string & mid)

Send an ICE candidate to the remote peer.

Parameters

  • peerId Remote peer identifier.

  • candidate The candidate string (from RTCIceCandidate).

  • mid The sdpMid value.


sendControl

virtual

virtual void sendControl(const std::string & peerId, const std::string & type, const std::string & reason)

Send a control message to the remote peer.

Parameters

  • peerId Remote peer identifier.

  • type Control type: "init", "accept", "reject", "hangup".

  • reason Optional reason string (for reject/hangup).


receive

void receive(const std::string & json)

setLocalPeerId

inline

inline void setLocalPeerId(const std::string & id)

localPeerId

const inline

inline const std::string & localPeerId() const

Private Attributes

ReturnNameDescription
std::string_localPeerId
std::mutex_mutex

_localPeerId

std::string _localPeerId

_mutex

std::mutex _mutex

Private Methods

ReturnNameDescription
voidsendJson

sendJson

void sendJson(const json::Value & msg)