Home

Awesome

GenericSocket

Class to trade socket messages Componente para troca de mensagens socket seguindo o modelo socketIO.

Installation ->

Installation is done using the boss install command:

boss install willhubner/GenericSocket

How to use ->

uses GenericSocket, GenericSocket.Interfaces;
  Socket : iGenericSocket;

  Socket := TGenericSocket.New;

  Socket.SocketServer.Start;
var
  ClientSocket : iGenericSocket;
begin  
  ClientSocket := TGenericSocket.New;

  ClientSocket
    .SocketClient
      .RegisterCallback('/route', route)
      .Connect('192.168.0.128', 8080, '@socket_name');

  function route(Message: String): String;
  begin
    Result := 'Callback '+Message;
  end;
end;  
var
  SocketResponse : iSocketMessage;
begin
  SocketResponse := Socket.SocketServer.Send(ListBox1.Items[ListBox1.ItemIndex] , '/route');