Websocket how? - page 19

 
Renat Fatkhullin:

No, it is a synchronous object.

I thought you wrote that you are planning some functions for asynchrony in mql.
Maybe theOnSocket event can be assigned there too?

 
Renat Fatkhullin:

No, it's a synchronous object.

I also support having a socket event handler so you don't have to do a continuous polling by timer. I'm sure the developers could implement it more elegantly.

 
Maxim Kuznetsov:

Maxim, since you are dealing with Websockets, can you try to connect to wss://api.huobi.pro/ws socket in your project without additional parameters?

The purpose is to find out if it's the library we use in C# or not.

IMHO the socket should open in any case, as well as through the site, without any additional parameters.

 
Fedor Arkhipov:

Maxim, since you are dealing with Websockets, can you try to connect to wss://api.huobi.pro/ws socket in your project without additional parameters?

The purpose is to find out if it's the library we use in C# or not.

IMHO socket should open in any case, as well as through the site, without any additional parameters.

The socket opens, even the subscription works.

C:\src>tclsh hibou.tcl                                                                                                                                                                                             Socket sock0000000002E8D890                                                                                                                                                                                        Connected :-)

put json:  { "sub": "market.btcusdt.kline.1min", "id": "1122" }

Message binary ▼       «V*ÈÌKW²24µ036µ425657©♣ ´áƒ!▬

Message binary ▼       «VÊLQ²R2442RÒQ*.I,)-♠òó³A¼Ò¤¤TlnbQvj‰^RIriqJ‰^vNf^ªžanf▲PQ      P¹¡©…™±©¥‘©‰‘±a- éÝ×kS

Message binary ▼       MÌÍ

à ►♦àwÙ³ˆëïêÛ´F→‰ÑҘö►òîM Ð∟g>f6ˆ#♦˜o¯)u~ïq]†Î§’kâ8ç

‘D♠ïV♫►„Rs具^ž÷¿òûþ♣¬↨Ã▬È     ¹u♀Jû\t̏ñ‚·¹­µ▼⌂š“q^£C-

Message binary ▼       MÌÍ

ƒ\?↨Òcºà°Ô­´þÇ◄“dHy÷F(4Ǚ™↔Â♦▲–á5ÇÆï-lëØøœS‰œ–T€A[Á“²ú¦œPŠ¬>«¶fð;¤ñOˆ♀ê3▬ðF↑âh↓„\×س%®

­CÈ   Ÿ€NæZ’ÔNôûß@âq|☺œ

data send, but it is either not GZ from the documentation, or smart chinese made headers :-)

have to deal with their compression, but I'm honestly too lazy :-)

PS script, which does it attached, there lines only nothing... it is possible to pull it from 4.

Files:
hibou.zip  1 kb
 
Maxim Kuznetsov:

PS the script that does this is attached, there are only a few lines...you can pull it from 4.

Thank you very much! So it's about the C# library.

 
Fedor Arkhipov:

Thank you very much! So, it must be about C# library.

I don't think it's that bad: she rather needs to tweak options/settings - firstly, hibou takes quite a long time to connect, timers can crash, and secondly, they are picky about TLS versions

 
Fedor Arkhipov:

Thank you very much! So it's about the C# library.

No, there's no problem in the library itself. Had to spend some time, but dug it out.

Downloaded several examples from githab, including the ones pointed out, none of them made the socket work. This was even more confusing. And the reason turned out to be the strengthening of the security certificate on the broker server.

Change the setting in our socket's instance:

We slightly adjust the Program class


This change was made so that the server would not be hardcoded in the library, but could be set from the Expert Advisor

The result:


So, as a result, the library is very wide-spectrum.

Next, let's attach the quotes call with Fedor.

There are more interested parties for this example, so let's continue to improve it.

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

Cool! It's working! Thank you very much, Alexey!

 

I tried to apply the library to MT4, EA file compiles without errors,

But when i attach it to chart i get error "Global initialization failed" if i use method that returns simple type.

If I try to get a structure, I get "Invalid ex4 file (8)

Would it work if I just throw out all the structures

Or if you need to mess with IL or com-ports

 
Fedor Arkhipov:

I tried to apply the library to MT4, EA file compiles without errors,

But when i attach it to chart i get error "Global initialization failed" if i use method that returns simple type.

and if I try to get a structure, I get "Invalid ex4 file (8)

Maybe it'll work if we throw out all the structures.

the C# to 4 is a separate sad song.

To 5 it's easy, it's got shuffle inside, otherwise string wouldn't be able to be returned from dll.

Reason: