• 概要
  • レビュー
  • コメント (1)
  • 最新情報

Easy websocket library for mql4

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: 
PLEASE CONTACT SELLER BEFORE PURCHASE.
Due to the nature of this kind of library, 

FULL FEATURE DEMO VERSION CAN BE PROVIDED ON REQUEST
==================================================


This library requires:

Win32 OpenSSL v1.1.1d

and MSVC 14 runtime 

which can be downloaded for free.


Sample code is as simple as following:

#include <wsmql.mqh>


void OnStart()
  {
   // ATTENTION: library initialization must be executed first
   wsInit();

   string url = "www.bitmex.com:443/realtime";
   string msg = "{ \"op\": \"subscribe\", \"args\" : [\"orderBookL2_25:XBTUSD\"] }";

   WSSHANDLE handle = wsConnect(url);

   int len;
   string resp;
   char recv_buffer[];
   ArrayResize(recv_buffer, 65536);

   if(handle!=0)
     {
      Sleep(1000);
      char buffer[];
      StringToCharArray(msg, buffer);

      wsSendBinary(handle, buffer, ArraySize(buffer)-1);

      int counter = 1;
      StringReserve(resp, 65536);

      while(!IsStopped())
        {
         len = 65535;
         counter = wsReceiveBinary(handle, recv_buffer, len);
         if(counter >= 0)
           {
            string r = CharArrayToString(recv_buffer,0, len);
            PrintFormat("+++ %d: %d [%s]", counter, len, r);
           }
         Sleep(100);
        }
      PrintFormat("*** disconnect");
      Sleep(1000);
      wsDisconnect(handle);
     }
   PrintFormat("*** DONE");
  }


API provided:

  • Connection:
    • WSSHANDLE wsConnect(string wssURL)
    • void wsDisconnect(WSSHANDLE handle)
  • Text send and receive:
    • int wsReceive(WSSHANDLE handle, string& buffer, int limit)
    • int wsSend(WSSHANDLE handle, string buffer)
  • Binary send and receive:
    • int wsReceiveBinary(WSSHANDLE handle, char& buffer[], int& limit)
    • int wsSendBinary(WSSHANDLE handle, char& buffer[], int limit)
  • Status:
    • int wsReceived(WSSHANDLE handle)
    • int wsIsConnected(WSSHANDLE handle)
Feel free to contact me for support and other options available.


=====================================
ATTENTION:

PLEASE CONTACT SELLER BEFORE PURCHASE.
=====================================


レビューなし
バージョン 191.20 2019.11.13
Improved integration.
Added wsInit() to initialize library.
Renamed to wsmqllib to indicate that this is a library.