Webserver API not sending moves or logs
I've gotten the WebAPI working with websockets where commands work well, and I'm getting the right responses, but I'm not getting moves or logEvents, but I do get temp and other events, so I know that bi-directional is working.
Here's the command I'm using the send request moves.
{ "data": {}, "action": "sendMoves", "printer": "Hictop", "callback_id": 7 }
I do get back a response, but there's no real information:
{"callback_id":7,"data":{},"session":"XptyN53F80hS1kmCB*@4&hE&A^C81p@k"}
Is there something different I should put to get the correct behavior?
Thanks
Comments
i´ve 2 printers and I am sending the activePrinter ( action:"activePrinter", printer:"slug") ) and next the sendMoves (action: "sendMoves" ) for both but nothing happens. Is there something what i miss?
I want to get the Event "move" as feedback to check the position of z-axis.
When you just want the latest x,y,z position there is an other function that also works for all printers in parallel. action stateList returns states for all printers which also include x, y and z position form last send command.
Both printers have been printing during the test.
move
Payload: {"x":1,"y":1,"z":0,"e":67.233,"de":0.023}When moves are enabled (sendMoves action) you will get a event for every move the printer does. This can be used to provide a live preview of what the printer does.
Mine is not sending out the moves right now.
I get all others during the print.
Could it be, that it will be only send through the same websocket? Because i´ve one thread opening and closing the websocket to get single requests, like you see the output below...but i´ve another thread which listen to the Events.
Do i need to use the same websocket to get this information or is it send to all websockets which are listening?
(i believe it might be the first idea...only to the same ws...)
And yes, i do check for multiple "data" entries in one response. I figured this out on another question, that there might be more then one data entry for a response...
So, i´ve some output for you (my function is properly set up to get all datas from the ws):
Receive:
Send:
Receive:
Send:
Receive:
Send:
###############
After checking the browser websocket i´ve tried with this one, like it is handled in your web application.
#####################################
Receive:
#############
You see callback_id is meant exactly to allow this. That way you know which response matches which request and you can make a list of open callbacks. Events have id -1 as they are not result of an action. So all actions should have a callback function as well that get send for the ws dispatcher to get called once result is received..