API reference / @jsprismarine/raknet / Frame
Class: Frame
Defined in: raknet/src/protocol/Frame.ts:48
Constructors
Constructor
new Frame():
Frame
Returns
Frame
Properties
content
content:
Buffer
Defined in: raknet/src/protocol/Frame.ts:62
fragmentId
fragmentId:
number
Defined in: raknet/src/protocol/Frame.ts:59
fragmentIndex
fragmentIndex:
number
Defined in: raknet/src/protocol/Frame.ts:60
fragmentSize
fragmentSize:
number=0
Defined in: raknet/src/protocol/Frame.ts:58
orderChannel
orderChannel:
number
Defined in: raknet/src/protocol/Frame.ts:56
orderIndex
orderIndex:
number|null=null
Defined in: raknet/src/protocol/Frame.ts:55
reliability
reliability:
FrameReliability=FrameReliability.UNRELIABLE
Defined in: raknet/src/protocol/Frame.ts:49
reliableIndex
reliableIndex:
number|null=null
Defined in: raknet/src/protocol/Frame.ts:51
sequenceIndex
sequenceIndex:
number|null=null
Defined in: raknet/src/protocol/Frame.ts:53
Methods
fromBinary()
fromBinary(
stream):Frame
Defined in: raknet/src/protocol/Frame.ts:64
Parameters
stream
Returns
Frame
getByteLength()
getByteLength():
number
Defined in: raknet/src/protocol/Frame.ts:194
Returns
number
isFragmented()
isFragmented():
boolean
Defined in: raknet/src/protocol/Frame.ts:224
Returns
boolean
isOrdered()
isOrdered():
boolean
Defined in: raknet/src/protocol/Frame.ts:216
Returns
boolean
isOrderedExclusive()
isOrderedExclusive():
boolean
Defined in: raknet/src/protocol/Frame.ts:220
Returns
boolean
isReliable()
isReliable():
boolean
Defined in: raknet/src/protocol/Frame.ts:208
Returns
boolean
isSequenced()
isSequenced():
boolean
Defined in: raknet/src/protocol/Frame.ts:212
Returns
boolean
toBinary()
toBinary():
BinaryStream
Defined in: raknet/src/protocol/Frame.ts:107
Returns
writeHeaderInto()
writeHeaderInto(
out,offset):number
Defined in: raknet/src/protocol/Frame.ts:162
Writes only this frame's header, leaving its existing content buffer untouched.
Parameters
out
Buffer
The header destination buffer.
offset
number
The first byte to write.
Returns
number
The offset just past the header.
writeInto()
writeInto(
out,offset):number
Defined in: raknet/src/protocol/Frame.ts:151
Writes this frame straight into an already sized buffer, returning the offset just past it. Byte for byte the same as toBinary, which stays as the readable reference the equivalence test compares against.
The difference is where the bytes land: toBinary builds a BinaryStream, whose write appends by rebuilding a plain JS number array, so encoding one datagram costs O(frames²). The caller knows the exact size up front via getByteLength, so there is nothing to grow.
Parameters
out
Buffer
offset
number
Returns
number