• 概述
  • 评论
  • 评论

Wsslib MT4

You can now easily provide WEBSOCKET connection to javascript to your MT terminal.

An easy to use websocket server 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.1g
NOTE: Link might be outdated due to version update. Please visit https://slproweb.com/products/Win32OpenSSL.html and download Win32 OpenSSL Full Installer.

and MSVC 14 runtime  (x86)

which can be downloaded for free.

TIPS:
You can use this tool to troubleshoot DLL issue:
https://www.dependencywalker.com/

Sample code is as simple as following:
It handles 2 paths /echo and /ehlo with 2 different handler functions.

#define TIMEOUT 10
...

void OnStart()
  {

   // CALLBACKS for endpoint /echo
   wssd_callbacks_t echo;
...

   // CALLBACKS for endpoint /ehlo
   wssd_callbacks_t ehlo;
...
   // SSL certificates
   string server_crt = "localhost.crt"; // relative to terminal.exe folder
   string server_key = "localhost.key"; // relative to terminal.exe folder
//string server_crt = "c:\\code\\localhost.crt"; // absolute path
//string server_key = "c:\\code\\localhost.key"; // absolute path

   int res;
   int port = 8080;
   int threads = 5;
   
   WSSDHANDLE handle = wssdInit(server_crt, server_key, port, threads);
   // endpoints are "regular expresion" to accept any query parameters 
   // sent by websocket client
   //
   // Register all endpoints before calling wssdPoll()
   res = wssdRegister(handle, "^/echo/?$", echo);
   res = wssdRegister(handle, "^/ehlo/?$", ehlo);

   int timeout = TIMEOUT;
   while(!IsStopped())
     {
      res = wssdPoll(handle);
      if(res > 0)
        {
         // A simple example to broadcast message to a specific endpoint _path
         // all connected clients to that endpoint will receive same message
         if(timeout-- < 0)
           {
            timeout = TIMEOUT;
            string bcast = StringFormat("(BCAST: %d)", GetTickCount());
            char send_buffer[];
            StringToCharArray(bcast, send_buffer);
            int len = StringLen(bcast);
            string _path = "/echo";
            wssdBroadcast(handle, send_buffer, len, _path);
           }
        }
      Sleep(1);
     };
   Print("* closing...");
   wssdDeinit(handle);
   Print("* done");
  }

//+------------------------------------------------------------------+

API provided:

  • Callbacks
    • on_open
    • on_close
    • on_message
    • on_error
  • Initialization / Deinitialization
    • wsdInit()
    • wsdDeinit()
    • wsdRegister()
    • wsdResetHandlers()
  • Polling:
    • wsdPoll()
  • Transmit data:
    • wsdBroadcast()
    • wsdSend()
  • Connection:
    • wsdClose()
    • wsdGetRemote()
    • wsdGetQuery()
    • wsdGetHeaders()


Feel free to contact me for support and other options available.


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

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

*** FOR DEVELOPER ONLY ***

推荐产品
该产品的买家也购买
筛选:
无评论