C# Class Simpl.OODSS.Distributed.Server.WebSocketOODSSServer

Inheritance: Simpl.OODSS.Distributed.Impl.AbstractServer, ServerProcessor
Afficher le fichier Open project: ecologylab/simplCSharp Class Usage Examples

Protected Properties

Свойство Type Description
ClientSessionManagerMap WebSocketClientSessionManager>.DictionaryList
CloseEvent System.Threading.AutoResetEvent
DataReceiveEvent System.Threading.AutoResetEvent
MaxMessageSize int
MessageReceiveEvent System.Threading.AutoResetEvent
OpenedEvent System.Threading.AutoResetEvent
ServerThread Thread

Méthodes publiques

Méthode Description
ProcessRead ( WebSocketSession session, long uid, string message ) : void

process the recieved message and uid. if sessionManager does not exist, create add it to the client session manager map process the message and send the response message back to the client

RestoreContextManagerFromSessionId ( string incomingSessionId, string newSessionId, BaseSessionManager newSessionManager ) : bool

restore old sessionManager for recovered session. returns true if the session is restored, false if the old session doesn't exist thus cannot be restored.

Start ( ) : bool

start server

Stop ( ) : void

stop server

WebSocketOODSSServer ( SimplTypesScope serverTranslationScope, Scope applicationObjectScope, int idleConnectionTimeout = -1, int maxMessageSize = -1, int port ) : System

Initialize a websocket oodss server object

processSessionClosed ( string sessionid ) : void

Méthodes protégées

Méthode Description
GenerateContextManager ( string sessionId, SimplTypesScope translationScope, Scope applicationObjectScope ) : BaseSessionManager

Generate WebSocketClientSessionManager

SendUpdateMessage ( string sessionId, UpdateMessage updateMessage ) : void

called by the session manager to send out update message.

WebSocketServer_SessionClosed ( WebSocketSession session, CloseReason reason ) : void

Private Methods

Méthode Description
CreatePacketFromMessageAndSend ( long uid, ServiceMessage message, WebSocketSession session ) : void

helper function to generate and send byte array message to client session.

SetUpWebSocketServer ( int port ) : void
WebSocketServer_NewDataReceived ( WebSocketSession session, byte e ) : void
WebSocketServer_NewMessageReceived ( WebSocketSession session, string e ) : void
WebSocketServer_NewSessionConnected ( WebSocketSession session ) : void

Method Details

GenerateContextManager() protected méthode

Generate WebSocketClientSessionManager
protected GenerateContextManager ( string sessionId, SimplTypesScope translationScope, Scope applicationObjectScope ) : BaseSessionManager
sessionId string client's session id
translationScope Simpl.Serialization.SimplTypesScope translation scope for the server
applicationObjectScope Scope server's application scope
Résultat Simpl.OODSS.Distributed.Server.ClientSessionManager.BaseSessionManager

ProcessRead() public méthode

process the recieved message and uid. if sessionManager does not exist, create add it to the client session manager map process the message and send the response message back to the client
public ProcessRead ( WebSocketSession session, long uid, string message ) : void
session WebSocketSession the client's websocket session
uid long uid of the message
message string message in serialized form
Résultat void

RestoreContextManagerFromSessionId() public méthode

restore old sessionManager for recovered session. returns true if the session is restored, false if the old session doesn't exist thus cannot be restored.
public RestoreContextManagerFromSessionId ( string incomingSessionId, string newSessionId, BaseSessionManager newSessionManager ) : bool
incomingSessionId string received sesion id information
newSessionId string
newSessionManager Simpl.OODSS.Distributed.Server.ClientSessionManager.BaseSessionManager a new session manager
Résultat bool

SendUpdateMessage() protected méthode

called by the session manager to send out update message.
protected SendUpdateMessage ( string sessionId, UpdateMessage updateMessage ) : void
sessionId string client's session id
updateMessage Simpl.OODSS.Messages.UpdateMessage update message
Résultat void

Start() public méthode

start server
public Start ( ) : bool
Résultat bool

Stop() public méthode

stop server
public Stop ( ) : void
Résultat void

WebSocketOODSSServer() public méthode

Initialize a websocket oodss server object
public WebSocketOODSSServer ( SimplTypesScope serverTranslationScope, Scope applicationObjectScope, int idleConnectionTimeout = -1, int maxMessageSize = -1, int port ) : System
serverTranslationScope Simpl.Serialization.SimplTypesScope translationscope for the oodss messages
applicationObjectScope Scope server object scope
idleConnectionTimeout int
maxMessageSize int
port int
Résultat System

WebSocketServer_SessionClosed() protected méthode

protected WebSocketServer_SessionClosed ( WebSocketSession session, CloseReason reason ) : void
session WebSocketSession
reason CloseReason
Résultat void

processSessionClosed() public méthode

public processSessionClosed ( string sessionid ) : void
sessionid string
Résultat void

Property Details

ClientSessionManagerMap protected_oe property

protected DictionaryList ClientSessionManagerMap
Résultat WebSocketClientSessionManager>.DictionaryList

CloseEvent protected_oe property

protected AutoResetEvent,System.Threading CloseEvent
Résultat System.Threading.AutoResetEvent

DataReceiveEvent protected_oe property

protected AutoResetEvent,System.Threading DataReceiveEvent
Résultat System.Threading.AutoResetEvent

MaxMessageSize protected_oe property

protected int MaxMessageSize
Résultat int

MessageReceiveEvent protected_oe property

protected AutoResetEvent,System.Threading MessageReceiveEvent
Résultat System.Threading.AutoResetEvent

OpenedEvent protected_oe property

protected AutoResetEvent,System.Threading OpenedEvent
Résultat System.Threading.AutoResetEvent

ServerThread protected_oe property

protected Thread ServerThread
Résultat Thread