Jump to content
Sign in to follow this  
JimKueneman

WebSockets

Recommended Posts

Next question.  I am new to this web technology so this is likely not a true SMS question but maybe.  I have created a TW3WebSocket.  I have a web server started on my Mac with "sudo apachectl start"  I now have a Lazarus program running that is a TCP server on the Mac.   SMS is running in a VMWare machine on XP.  I run my SMS script and press a button that does this:

 

procedure TFormMain.W3Button1Click(Sender: TObject);

begin
  FSocket.Connect('ws://10.0.3.198:12021', []);
end;
 
I am sure there is something I should be passing in the sub-protocol parameter but this runs.
 
My Lazarus app connects to the TCP request but I never get this call:
 
procedure TFormMain.SocketOpen(Sender: TW3WebSocket);
begin
  Application.ShowDialog('Opened', 'Socket is Opened', aoCancel);
end;
 
So it appears that the TCP link was made but the WebSocket did not connect really connect yet.   When I execute this:
 
procedure TFormMain.W3Button2Click(Sender: TObject);
begin
  if FSocket.Connected then
    FSocket.Disconnect
end;
 
Connected returns "True" but the Disconnect call throws an error saying the WebSocket was not really connected so it can't really disconnect it.
 
We have a TCP protocol defined that I want to run over the WebSocket.  It is currently GridConnect String based so it should be possible (I understand that you can run binary over WebSockets now too).  I am assuming that I need to pack my protocol into a protocol that WebSockets support. 
 
Is there something built into SMS that gets me the first level of protocol (if that is my problem) or is there a good beginner tutorial that can help me understand what I am missing in my approach?
 
Thanks,
JIm

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×