Class ArchipelagoSocketHelper
- Namespace
- Archipelago.MultiClient.Net.Helpers
- Assembly
- Archipelago.MultiClient.Net.dll
public class ArchipelagoSocketHelper : IArchipelagoSocketHelper
- Inheritance
-
ArchipelagoSocketHelper
- Implements
- Inherited Members
Properties
Connected
Returns true if the socket believes it is connected to the host. Does not emit a ping to determine if the connection is stable.
public bool Connected { get; }
Property Value
Uri
The URL of the host that the socket is connected to.
public Uri Uri { get; }
Property Value
Methods
Connect()
Initiates a connection to the host.
public void Connect()
Disconnect()
Disconnect from the host.
public void Disconnect()
DisconnectAsync()
Disconnect from the host asynchronously. Handle the SocketClosed event to add a callback.
public void DisconnectAsync()
SendMultiplePackets(params ArchipelagoPacketBase[])
Send multiple ArchipelagoPacketBase derived packets.
public void SendMultiplePackets(params ArchipelagoPacketBase[] packets)
Parameters
packets
ArchipelagoPacketBase[]The packets to send to the server.
Remarks
The packets will be sent in the order they are provided as arguments.
Exceptions
- ArchipelagoSocketClosedException
The websocket connection is not alive.
SendMultiplePackets(List<ArchipelagoPacketBase>)
Send multiple ArchipelagoPacketBase derived packets.
public void SendMultiplePackets(List<ArchipelagoPacketBase> packets)
Parameters
packets
List<ArchipelagoPacketBase>The packets to send to the server.
Remarks
The packets will be sent in the order they are provided in the list.
Exceptions
- ArchipelagoSocketClosedException
The websocket connection is not alive.
SendMultiplePacketsAsync(Action<bool>, params ArchipelagoPacketBase[])
Send a single ArchipelagoPacketBase derived packet asynchronously.
public void SendMultiplePacketsAsync(Action<bool> onComplete = null, params ArchipelagoPacketBase[] packets)
Parameters
onComplete
Action<bool>A callback function to run after the send is complete. The bool argument for the callback indicates whether the send was successful.
packets
ArchipelagoPacketBase[]The packets to send to the server.
Remarks
The packets will be sent in the order they are provided as arguments.
Exceptions
- ArchipelagoSocketClosedException
The websocket connection is not alive.
SendMultiplePacketsAsync(List<ArchipelagoPacketBase>, Action<bool>)
Send a single ArchipelagoPacketBase derived packet asynchronously.
public void SendMultiplePacketsAsync(List<ArchipelagoPacketBase> packets, Action<bool> onComplete = null)
Parameters
packets
List<ArchipelagoPacketBase>The packets to send to the server.
onComplete
Action<bool>A callback function to run after the send is complete. The bool argument for the callback indicates whether the send was successful.
Remarks
The packets will be sent in the order they are provided in the list.
Exceptions
- ArchipelagoSocketClosedException
The websocket connection is not alive.
SendPacket(ArchipelagoPacketBase)
Send a single ArchipelagoPacketBase derived packet.
public void SendPacket(ArchipelagoPacketBase packet)
Parameters
packet
ArchipelagoPacketBaseThe packet to send to the server.
Exceptions
- ArchipelagoSocketClosedException
The websocket connection is not alive.
SendPacketAsync(ArchipelagoPacketBase, Action<bool>)
Send a single ArchipelagoPacketBase derived packet asynchronously.
public void SendPacketAsync(ArchipelagoPacketBase packet, Action<bool> onComplete = null)
Parameters
packet
ArchipelagoPacketBaseThe packet to send to the server.
onComplete
Action<bool>A callback function to run after the send is complete. The bool argument for the callback indicates whether the send was successful.
Exceptions
- ArchipelagoSocketClosedException
The websocket connection is not alive.
Events
ErrorReceived
Handler for error on the socket or during parsing of the packets
public event ArchipelagoSocketHelperDelagates.ErrorReceivedHandler ErrorReceived
Event Type
PacketReceived
Handler for recieved and sucsesfully parsed packages
public event ArchipelagoSocketHelperDelagates.PacketReceivedHandler PacketReceived
Event Type
PacketsSent
Handler for packets published to the websocket, called before the packet is handled by the server
public event ArchipelagoSocketHelperDelagates.PacketsSentHandler PacketsSent
Event Type
SocketClosed
Handler for when the underlaying socket connection is closed
public event ArchipelagoSocketHelperDelagates.SocketClosedHandler SocketClosed
Event Type
SocketOpened
Handler for when the underlaying socket connection is opened to the archipelago server
public event ArchipelagoSocketHelperDelagates.SocketOpenedHandler SocketOpened