discontinuedPackage shsp_implementations has been discontinued.

ShspInstance class

SHSP Instance: manages handshake, closure, keep-alive and data messages.

Inheritance

Constructors

ShspInstance({required PeerInfo remotePeer, required IShspSocket socket, int keepAliveSeconds = 30})
ShspInstance.create({required PeerInfo remotePeer, required IShspSocket socket, int keepAliveSeconds = 30})
Factory: creates a new SHSP instance with configurable keep-alive.
factory
ShspInstance.fromPeer(ShspPeer peer, {int keepAliveSeconds = 30})
Factory: creates a new SHSP instance from an existing ShspPeer.
factory

Properties

closing → bool
Check if the instance is in closing state
no setter
handshake → bool
Check if handshake has been completed
no setter
hashCode → int
The hash code for this object.
no setterinherited
keepAliveSeconds ↔ int
Get the keep-alive interval in seconds
getter/setter pair
keepAliveTimer ↔ KeepAliveTimer?
getter/setter pair
messageCallback → MessageCallback
no setterinherited
onClose ↔ CallbackOn
getter/setter pair
onClosing ↔ CallbackOn
getter/setter pair
onHandshake ↔ CallbackOn
getter/setter pair
onOpen ↔ CallbackOn
getter/setter pair
open → bool
Check if the connection is open
no setter
remotePeer → PeerInfo
finalinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
socket → IShspSocket
finalinherited

Methods

close() → void
Override close() to ensure keep-alive timer is stopped
override
keepAlive() → void
Send a keep-alive message
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onMessage(List<int> msg, PeerInfo info) → void
Internal callback triggered when a message arrives for this peer
override
resetKeepAlive() → void
Resets the keep-alive timer (postpones the next sending).
sendClosed() → void
Send a closed signal
sendClosing() → void
Send a closing signal
sendHandshake() → void
Send a handshake message
sendMessage(List<int> message) → void
Send a message to this peer
override
serializedObject() → String
Get a serialized representation of the peer
inherited
startKeepAlive() → void
Starts periodic keep-alive sending.
stopKeepAlive() → void
Stops periodic keep-alive sending.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited