usual mean, hit the command api, not to LB?
No, for the API you obviously hit the load balancer.
but i receive. 202 Accepted response.
when i see the routes, LB forward to server where not connected to the device.
What is the problem with that response?
it means the command not receive/queue to the device because device not connected to this server, but connect to other server
No, it doesn't mean that. If the device is connected to another server, the command will be sent.
like this, https://youtu.be/VFqorQG6zKY
the command has send to "api/commands/send" not delivered to devices
It's not fully clear to me what is shown on the video. We don't know if the script is correct. I see that at least the multicast seems to be working, so both servers should receive the command.
this is my script
import socket
import struct
MCAST_GRP = '224.0.0.1'
MCAST_PORT = 7777
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP)
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
sock.bind((MCAST_GRP, MCAST_PORT))
mreq = struct.pack("4sl", socket.inet_aton(MCAST_GRP), socket.INADDR_ANY)
sock.setsockopt(socket.IPPROTO_IP, socket.IP_ADD_MEMBERSHIP, mreq)
while True:
print(sock.recv(10240))
That's your multicast, but what about the device? That's the one that's not working, right?
yes, expected when i send command ("api/commands/send") to LB. LB forwarded to server A where not connected to the device, but server B where the server has connected to the device not received the message multicast..
Then I don't understand the video at all. I see the command in your multicast console. Did I miss something?
hmm, can I change the multicast method to use a message broker, like MQTT, Kafka, rabbit MQ, etc..?
You can implement a different synchronization method. Feel free to send a pull request.
Usual way.