dingmaotu / mql-zmq

ZMQ binding for the MQL language (both 32bit MT4 and 64bit MT5)
Apache License 2.0
543 stars 298 forks source link

How to perform authentication #50

Closed jayaruvan closed 10 months ago

jayaruvan commented 4 years ago

How can i send Username/PAssword when connecting to server. I am receiving below

1591613328: New connection from 122.255.11.106 on port 1883. 1591613328: Client disconnected due to protocol error.

Can you please add an example with mql

jayaruvan commented 4 years ago

bump

jayaruvan commented 3 years ago

bump

dingmaotu commented 3 years ago

Hi, @jayaruvan there are two ways for authentication:

  1. you make your own username/password based authentication protocol, and encrypting your traffic with custom hash functions.
  2. using zmq_curve (which is enabled in this library): http://api.zeromq.org/master:zmq-curve. curve uses asymmetrical key encryption so it is very secure. You don't want to use plain username/password for authentication in a public network. instead of username/password, you distribute key pairs (like licenses) to your client.
jayaruvan commented 3 years ago

Thank you for the reply.

My MQTT server (mosquito / centos7 ) is hosted externally ( global static IP). When I trying to connect to that I am getting this error message

1591613328: New connection from 122.255.11.106 on port 1883. 1591613328: Client disconnected due to protocol error. Can you please add an example with mql

However, If I host it locally /same pc, this works fine. I have checked firewall also. Also, I can connect to my MQTT service via nodejs application.

Basically I want to connect to MQTT server hosted externally. I am really grateful, if you can illustrate how I can achieve this?

jayaruvan commented 3 years ago

bump

dingmaotu commented 10 months ago

I think you should use a MQTT client instead of a ZMQ client.