This website requires JavaScript.
Explore
Help
Sign In
joshua
/
websockify
Watch
1
Star
0
Fork
You've already forked websockify
0
Code
Issues
Pull Requests
Projects
Releases
Wiki
Activity
6a268a09b6
websockify
/
run
8 lines
98 B
Plaintext
Raw
Normal View
History
Unescape
Escape
run: invoke websockify through 'python -m'
2019-06-13 16:16:55 +01:00
#!/usr/bin/env sh
Refactor into python modules: websocket, websocketproxy Make websockify subdirectory and move websocket.py -> websockify/websocket.py and websockify -> websockify/websocketproxy.py. Create a ./run script that launches websockify as before (unfortunately can't have a websockify script at the same level since this is now a directory). Make websockify.py a symlink to ./run. Once the package is installed, the main launch script will be /usr/bin/websockify. This makes it easier to package up websockify as a python module. setup.py should now properly install websockify as a module. Note that to include the base websocket module/class you will now do: import websockify.websocket #OR from websockify.websocket import WebSocketServer To import the full websocket proxy functionality: import websockify.websocketproxy #OR from websockify.websocket import WebSocketProxy This will also help with startup speed slightly because the code in websocketproxy will now be byte compiled since it is no longer in the main invocation script.
2012-09-17 20:06:51 +01:00
Use safer method to get base directory realpath isn't available on older systems, so use a safer approach using just very basic commands.
2019-06-24 14:38:52 +01:00
BASE_DIR="$(cd $(dirname "$0"); pwd)"
Refactor into python modules: websocket, websocketproxy Make websockify subdirectory and move websocket.py -> websockify/websocket.py and websockify -> websockify/websocketproxy.py. Create a ./run script that launches websockify as before (unfortunately can't have a websockify script at the same level since this is now a directory). Make websockify.py a symlink to ./run. Once the package is installed, the main launch script will be /usr/bin/websockify. This makes it easier to package up websockify as a python module. setup.py should now properly install websockify as a module. Note that to include the base websocket module/class you will now do: import websockify.websocket #OR from websockify.websocket import WebSocketServer To import the full websocket proxy functionality: import websockify.websocketproxy #OR from websockify.websocket import WebSocketProxy This will also help with startup speed slightly because the code in websocketproxy will now be byte compiled since it is no longer in the main invocation script.
2012-09-17 20:06:51 +01:00
run: invoke websockify through 'python -m'
2019-06-13 16:16:55 +01:00
cd "$BASE_DIR"
python -m websockify $@