-
-
Notifications
You must be signed in to change notification settings - Fork 384
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to connect via Websocket and send g-codes #138
Comments
The websocket port number is 1 more than the http port, so if the http port is at its default value of 80, you will need to connect on port 81 for the websocket. After that you can send Grbl commands like over a serial connection. |
Thanks for the info. import websocket
import _thread
import time
def on_message(ws, message):
print('in message ', message)
def on_error(ws, error):
print('error: ', error)
def on_close(ws, close_status_code, close_msg):
print("### closed ###")
def on_open(ws):
def run(*args):
ws.send('$HX\n')
time.sleep(1)
ws.close()
print("thread terminating...")
_thread.start_new_thread(run, ())
if __name__ == "__main__":
websocket.enableTrace(True)
ws = websocket.WebSocketApp("ws://10.88.111.15:81",
on_open=on_open,
on_message=on_message,
on_error=on_error,
on_close=on_close)
ws.run_forever() And here is the log:
|
I found a bug in the websocket handling. The bug is now fixed in the WebSockets branch. Here is simple test showing it basically working.
|
Thanks for the fix. I confirm that it solved the issue for Linux as well. |
Fixed by #142 |
Hi,
I am trying to write a python client application to send my commands through the wifi connection to the Fluidnc host.
I am not sure how I should setup the connection in the python client side.
Here's a brief description of my attempt:
So in the python code I tried the following:
There are two points of uncertainties for me:
ws4py
library (other thanwebsockets
), I get the following message afterconnect
which gives me an impression that there's something missing:I'd appreciate any feedback if anyone has been able to get it working with a websocket client.
Regards
The text was updated successfully, but these errors were encountered: