API reference / @jsprismarine/nethernet / SignalStructure
Class: SignalStructure
Defined in: packages/nethernet/src/protocol/Signal.ts:52
One signal: <TYPE> <connection id> <data>, where the data is an SDP description, a candidate line or an error code. The network ID is the peer's, which the carrier knows, not the text.
Constructors
Constructor
new SignalStructure(
type,connectionId,data,networkId?):SignalStructure
Defined in: packages/nethernet/src/protocol/Signal.ts:59
Parameters
type
What the signal is.
connectionId
bigint
The connection the client picked an ID for.
data
string
The description, candidate or error code.
networkId?
bigint
The other side's network ID, when the carrier names it.
Returns
SignalStructure
Properties
connectionId
readonlyconnectionId:bigint
Defined in: packages/nethernet/src/protocol/Signal.ts:61
The connection the client picked an ID for.
data
readonlydata:string
Defined in: packages/nethernet/src/protocol/Signal.ts:62
The description, candidate or error code.
networkId?
optionalnetworkId?:bigint
Defined in: packages/nethernet/src/protocol/Signal.ts:63
The other side's network ID, when the carrier names it.
type
readonlytype:SignalType
Defined in: packages/nethernet/src/protocol/Signal.ts:60
What the signal is.
Methods
toString()
toString():
string
Defined in: packages/nethernet/src/protocol/Signal.ts:83
The signal's text.
Returns
string
fromString()
staticfromString(message):SignalStructure
Defined in: packages/nethernet/src/protocol/Signal.ts:72
Parses a signal's text.
Parameters
message
string
The text, as LAN discovery or a signaling service carries it.
Returns
SignalStructure
The signal.
Throws
When the type is unknown or the connection ID is not an unsigned integer.