Websocket how? - page 15

 
Алексей Барбашин:

Found it in the back of my mind:

Transmission of integer variables does not require marshalling

Here's the structure transfer, no marshalling required either. Here is the structure itself:

And only transferring a string value required a marshalling:

I implemented all this on MT4. That is, if I had looked into this old code yesterday, I would have seen my yesterday's error. I have to thank Vladimir for paying attention to it and helping me to correct it.

That's what I mean - you can handle simple types without any problems, while you will have to tinker with complex types.

But the problem is deeper there - call of .Net from MQL4 will not work with complex class libraries, you can not provide all static calls, the solution is banal - dll export from .Net should start a new thread of "pure .Net" and then the exchange with the stream can be handled inside the dll.

All in all, it's a fun adventure when you start from scratch ))))


Alexei Barbashin:

I recommend to use DllExport, you will see how dramatically everything becomes easier! :)

Not easier, but the same - one and the same, especially for me everything is already set up and working

But it's easier to write in MQL5 and not to bother, and with MT4 you have to organize just the exchange ;)

 

Maybe because we don't close the socket and it creates a new one all the time when I compile?

 

deleted the library, pressed rebuild, then it worked


 
Алексей Барбашин:

And the one is what?

is how many messages are in the queue
 
Алексей Барбашин:

Well now you can try to switch back to the console application and try to get the data from the broker you wanted. Where is its api page?

here's https ://cloudapidoc.github.io/API_Docs/v1/ws/en/#general

and here https://www.huobi.com.ru/ru-ru/user/api/

WebSocket API
  • cloudapidoc.github.io
wss://{HOST}/ws Host structure Authenticated APIs:www.xxxx.com Public APIs: www.xxxx.com/api Data All return data of websocket APIs needs to be unzipped. Library Recommend: ws by Node.js Topic type topic description : { ethbtc, ltcbtc, etcbtc, bccbtc ... } Heartbeat If the type of request message is not , websocket server will response...
 
Алексей Барбашин:


Root URL::: The root URL

www.huobi.com.ru/api

ключ 02e47f17-259d6a49-edrfhh5h53-4c700

 

There's this

there's also their global website

https://huobiglobal.zendesk.com/hc/en-us/articles/900000014146-Huobi-Global-will-include-two-new-subscription-topics-in-existing-Websocket-API

but something doesn't work

Socket = new WebSocket("wss://www.huobi.com.ru/api/ws/v2");
//Socket = new WebSocket("wss://api.huobi.pro/ws/v2");

 

I tried both /v1 and without, it still doesn't open the socket

I removed the key, it must be needed for REST

 
Алексей Барбашин:

As for websocket in mql, no one has been able to implement it so far.

There is a library in the marketplace.
For 4
andfor 5.

It seems that the ban on DLL calls for products from the marketplace has not been lifted yet, so I would not be so categorical.

Торговую библиотеку Easy websocket library for mql4
Торговую библиотеку Easy websocket library for mql4
  • www.mql5.com
An easy to use websocket library for MQL4. It supports: ws:// and wss:// (secure websocket) text and binary data automatic ping-pong handling on protocol level (keep-alive protocol hand shake) automatic fragmented message handling on protocol level (large data transfer enabled) ================================================== ATTENTION: ...
 
Mikhail Dovbakh:

There is a certain library in the marketplace.
For 4
and for 5 .

It seems that the ban on calling the DLL for products from the market has not been lifted yet, so I would not be so categorical

It's hard to guess that the Indonesian guy did it. They and Nigerians and I think even Indians have a new trick with every code.

well, you already found #include <wsmql.mqh>https://www.mql5.com/ru/search#!keyword=wsmql.mqh

but what do you suggest to do about renaming the downloaded file:Please rename the from MQL5 MARKET downloaded file to wsmqllib.ex5 / Please rename the from MQL5 MARKET downloaded file to wsmqllib.ex4

Seller profile clean sheet, 2 codes in KB, some kind of mysterious manipulation on Mladen's codes ))))

Reason: