Giter VIP home page Giter VIP logo

horse-socketio's Introduction

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-SocketIO

How 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.

horse-socketio's People

Contributors

andrewsbejatto avatar willhubner avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.