WebSocket Client? lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- BlueIcaro · 2018-02-26 15:18 Hi, I want to connect to a instrustial machine. This machine use rest api to send info. I don't have any problem asking information. I make a Get or Post using a ThttpSend (synapse), and I got the information But I need use websocket to get  info dynamic. Because, according with manufacter, I can subscribe to some information. I send some info, using a Post then the machine send me information using a websocket. The documentation of this machine provides some examples in C.Net. They use https://github.com/sta/websocket-sharp library. Basically  I need a Websocket client. Is there any component, or info about WebSocket in fcp/lazarus? Thanks in advance /BlueIcaro ---------------------------------------------------------------------- Leledumbo · 2018-02-26 18:36 Not tested: https://github.com/Robert-112/Bauglir-WebSocket-2 ---------------------------------------------------------------------- JD · 2018-02-26 19:45 Have you seen this https://forum.lazarus.freepascal.org/index.php/topic,30649.0.html I know mORMot has WebSockets. DonAlfredo posted an example some years ago where he used WebSockets with the TVPlanit component. warleyalex is another member of this forum who uses mORMot websockets. He even has demo videos on Youtube. JD ---------------------------------------------------------------------- BlueIcaro · 2018-02-27 15:29 Quote from: JD on February 26, 2018, 08:45:01 pmHave you seen this https://forum.lazarus.freepascal.org/index.php/topic,30649.0.html I know mORMot has WebSockets. DonAlfredo posted an example some years ago where he used WebSockets with the TVPlanit component. warleyalex is another member of this forum who uses mORMot websockets. He even has demo videos on Youtube. JD Thanks I saw it. I was looking for a component like indy  Reading the information, I need a cookie and other information, to connect to my machine. So I have to read code, try it, etc. Quote from: Leledumbo on February 26, 2018, 07:36:45 pmNot tested: https://github.com/Robert-112/Bauglir-WebSocket-2 I'll  take a look. The post that @JD pointed, and this will be my starting point /BlueIcaro ---------------------------------------------------------------------- JD · 2018-02-28 07:43 https://github.com/andremussche/DelphiWebsockets @BlueIcaro This one uses Indy but it is not active anymore. I wanted to try and port it to FPC but I was too busy. Maybe you can do it. Or maybo we can convince Remy Lebeau!  JD ---------------------------------------------------------------------- BlueIcaro · 2018-02-28 09:11 Quote from: JD on February 28, 2018, 08:43:51 amhttps://github.com/andremussche/DelphiWebsockets @BlueIcaro This one uses Indy but it is not active anymore. I wanted to try and port it to FPC but I was too busy. Maybe you can do it. Or maybo we can convince Remy Lebeau!  JD I downloaded this code, and the code in  C# that I posted in my first post. And other codes, but before ask in this forum I thought that I my be I have to write my own component or unit, because there I didn't find  any suitable solution (for me). Now I sure that I have to write my own code. I can connect to my machine using synapse. And I store the cookie. No problem until here. Reading the original C# example from the manufacter (you can see it here: http://developercenter.robotstudio.com/webservice/api_reference, click on examples/ElogSubscriber.cs ), they use a threat to read continuously, so the next step, for me, is make a thread and see what happens. Threads are almost new for me. I did one small application long time ago, and my experience is close to null in that issue. So I have a huge work ahead. I'll back with news (bad or goog I don't know). B.R. /BlueIcaro ---------------------------------------------------------------------- rvk · 2018-02-28 09:26 Quote from: BlueIcaro on February 26, 2018, 04:18:28 pmBasically  I need a Websocket client. If you are already using Synapse for THTTPSend, can't you use TTCPBlockSocket directly for the socket communications? You can also wrap it in a thread like this (TTCPClient): https://forum.lazarus.freepascal.org/index.php?topic=35603.0 ---------------------------------------------------------------------- BlueIcaro · 2018-03-02 10:24 Quote from: rvk on February 28, 2018, 10:26:07 amQuote from: BlueIcaro on February 26, 2018, 04:18:28 pmBasically  I need a Websocket client. If you are already using Synapse for THTTPSend, can't you use TTCPBlockSocket directly for the socket communications? You can also wrap it in a thread like this (TTCPClient): https://forum.lazarus.freepascal.org/index.php?topic=35603.0 Thanks I'll take a look /BlueIcaro ---------------------------------------------------------------------- Remy Lebeau · 2018-03-06 20:44 Quote from: BlueIcaro on February 27, 2018, 04:29:36 pmI was looking for a component like indy  WebSocket support is on Indy's todo list. #85 Add WebSocket support to TIdHTTPServer #201 Add a WebSocket client component ---------------------------------------------------------------------- BlueIcaro · 2018-03-07 06:53 Quote from: Remy Lebeau on March 06, 2018, 09:44:29 pmQuote from: BlueIcaro on February 27, 2018, 04:29:36 pmI was looking for a component like indy  WebSocket support is on Indy's todo list. #85 Add WebSocket support to TIdHTTPServer #201 Add a WebSocket client component That's cool Remy! /BlueIcaro