C# Class NetMud.Websock.Descriptor

Main handler of descriptor connections for websockets
Inheritance: NetMud.Websock.Channel, IDescriptor
Mostra file Open project: SwiftAusterity/NetMud

Private Properties

Property Type Description
DataAvailable Task
DecodeSocket string
EncodeSocket Byte[]
GetUserIDFromCookie void
OnClose void
OnError void
OnMessage bool
OnOpen void
Send void
SendPing void
StartLoop void
ValidateUser void
WriteData void

Public Methods

Method Description
Descriptor ( TcpClient tcpClient ) : Microsoft.AspNet.Identity

Creates an instance of the command negotiator

Descriptor ( TcpClient tcpClient, ApplicationUserManager userManager ) : Microsoft.AspNet.Identity

Creates an instance of the command negotiator with a specified user manager

Disconnect ( string finalMessage ) : void

Disconnects the client socket

Open ( ) : void

Open the socket, the client gets set up in the constructor

SendWrapper ( IEnumerable strings ) : bool

Wraps sending messages to the connected descriptor

SendWrapper ( string str ) : bool

Wraps sending messages to the connected descriptor

Private Methods

Method Description
DataAvailable ( NetworkStream stream ) : Task

Just sits on the stream waiting for a messgae to be sent

DecodeSocket ( byte buffer ) : string

Decodes WS headers and data from the stream

EncodeSocket ( string message ) : Byte[]

Encodes string messages into ws socket language

GetUserIDFromCookie ( string authTicketValue ) : void

Gets the user ID from the web from the aspnet cookie

OnClose ( ) : void

Handles when the connection closes

OnError ( Exception err ) : void

Handles when the connection faults

OnMessage ( string message ) : bool

Handles when the connected descriptor sends input

OnOpen ( ) : void

Handles initial connection

Send ( string message ) : void

Begins the send process for putting data into the socket stream

SendPing ( ) : void

Ping the client for keepalive

StartLoop ( bool>.Func worker ) : void

Handles the wait loop for accepting input from the socket

ValidateUser ( string handshake ) : void

Validates the game account from the aspnet cookie

WriteData ( IAsyncResult result ) : void

Ends the send loop

Method Details

Descriptor() public method

Creates an instance of the command negotiator
public Descriptor ( TcpClient tcpClient ) : Microsoft.AspNet.Identity
tcpClient System.Net.Sockets.TcpClient
return Microsoft.AspNet.Identity

Descriptor() public method

Creates an instance of the command negotiator with a specified user manager
public Descriptor ( TcpClient tcpClient, ApplicationUserManager userManager ) : Microsoft.AspNet.Identity
tcpClient System.Net.Sockets.TcpClient
userManager ApplicationUserManager the authentication manager from the web
return Microsoft.AspNet.Identity

Disconnect() public method

Disconnects the client socket
public Disconnect ( string finalMessage ) : void
finalMessage string the final string data to send the socket before closing it
return void

Open() public method

Open the socket, the client gets set up in the constructor
public Open ( ) : void
return void

SendWrapper() public method

Wraps sending messages to the connected descriptor
public SendWrapper ( IEnumerable strings ) : bool
strings IEnumerable the output
return bool

SendWrapper() public method

Wraps sending messages to the connected descriptor
public SendWrapper ( string str ) : bool
str string the output
return bool