Skip to content

horse-framework/horse-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 

Repository files navigation

Horse Server

NuGet

Horse Server is a TCP Server and includes Core modules for Horse Framework Libraries. Only use Horse Server directly if you develop new protocol extension for horse server.

If you are looking for Messaging Queue Server, HTTP Server with MVC Architecture, WebSocket Server/Client or IOC Library, you can check other repositories of Horse Framework.

Usage

HorseServer is an object, accepts TCP requests and finds the protocol which accepts the request. Here is a quick example which is used for accepting websocket connections used in horse websocket library.

public class ServerWsHandler : IProtocolConnectionHandler<WsServerSocket, WebSocketMessage>
{
  ...
}

...

ServerWsHandler handler = new ServerWsHandler();
HorseServer server = new HorseServer(ServerOptions.CreateDefault());
server.UseWebSockets(handler);
server.Start();

UseWebSockets is an extension method. If you need to add another protocol, you can create your own extension method that calls HorseServer's UseProtocol method. Or you can just add protocol to the server like this:

public class CustomProtocol : IHorseProtocol
{
  ...
}

...

server.UseProtocol(new CustomProtocol());

Thanks

Thanks to JetBrains for open source license to use on this project.

jetbrains