Catalog · How the catalog works
Horse-SocketIO
Middleware para Horse utilizando SocketIO.
- ★ 28 on GitHub
Anyone may press Interesting, signed in or not. It helps others find this project.
README
# Horse-SocketIO Middleware for Horse using SocketIO. Library on https://github.com/WillHubner/GenericSocket
Installation ->
Installation is done using the boss install command:
boss install willhubner/Horse-SocketIOHow to use ->
uses
Horse,
Horse.Jhonson,
Horse.SocketIO;
begin
THorse
.Use(Jhonson)
.Use(SocketIO);
THorse.Listen(9000);
end.Client Side ->
Install GenericSocket
boss install willhubner/genericsocket TGenericSocket
.New
.SocketClient
.RegisterCallback('/route',
function (Message : String) : String
begin
Result := 'Callback '+Message
end
)
.Connect('192.168.0.128', 8080, '@socket_name');Jump the Cat ->
In your request, put a HEADER named socket_client and value with the name of client socket, in the example, called "socket_name". Write your callback function acconding to the "route" especificated, map the functions that you use, when the request gets on horse, will be directed to client-socket.
The server socket will be started on port 8080.
The functions should be writen on client-socket, when the horse gets the header [socket_client] will redirect the calls.
Basic routes ->
[GET] /socket_clients*Return all connected clients.
[GET] /socket/[route]
[POST] /socket/[route]Function to redirect your calls
Example: https://www.youtube.com/watch?v=JYLbiNEzIgs
Português
Middleware para Horse utilizando SocketIO.
Biblioteca disponibilizada no link https://www.youtube.com/watch?v=nd2oqME0JAg
Para utilizar, coloque no HEADER a chave socket_client e o valor com o nome do cliente desejado.
Na aplica????o cliente, mapeie as fun????es que deseja, quando o request bater no horse, ser?? direcionado para o client-socket.
O servidor Socket ser?? startado na porta 55666.
As fun????es ser??o escritas dentro do cliente, e quando o horse receber o cabe??alho [socket_client] ir?? redirecionar as chamadas.
Para obter a lista de clientes, chame o m??todo /socket_clients na URL.
