You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
667 B
Markdown
35 lines
667 B
Markdown
# Gear Sockets
|
|
|
|
A websocket service for fo use in the gears application.
|
|
|
|
# Development
|
|
|
|
It is helpful to have a clean virtualenv:
|
|
|
|
```
|
|
python -m venv gears_sockets_env
|
|
source gears_sockets_env/bin/activate
|
|
```
|
|
|
|
DO NOT add this to version control
|
|
|
|
# Testing
|
|
|
|
|
|
## Websocket testing
|
|
|
|
The easiest way to test the websocket components is within the developer tools of the browser.
|
|
|
|
```javascript
|
|
ws = new WebSocket("ws://localhost:8010/ws"); // create new connection
|
|
|
|
|
|
// Log messages from the server
|
|
ws.onmessage = function (e) {
|
|
console.log('From Server: ' + e.data);
|
|
};
|
|
|
|
// Sending a String
|
|
ws.send('your message');
|
|
>>From Server: Message text was: your message
|
|
``` |