Closed babraham123 closed 10 years ago
If you want to serve on a certain port, instantiate with
WebSocket wsServer("/", 1234);
Default values for path is "/" and for port "80".
In client you give the external IP address, provided that you have routing/port mapping set up for that IP to the internal IP and port of the ino. If you're on internal network then only use ws://[internal ip]:[portno]/
Hope this helps.
Sorry to bother you, but I have a small question about your arduino library on github.
Question: How do you serve a websocket from within a local network? In my arduino code, I used the following setup parameters:
byte mac[] = { 0x90, 0xA2, 0xDA, 0x0E, 0xF5, 0xE7 }; byte ip[] = { [local IP address] }; // Create a Websocket server WebSocket wsServer;
Then, in my client side javascript code, I used the following parameters to open the websocket connection:
$('#connect').click(function() { if ('WebSocket' in window) { connection = new WebSocket('ws://[external ip address]/'); console.log('Connecting to server: ' + server); } });
Is this correct? It doesn't seem to work. Also, if I want to use a different port, How do I set that up within the server code? I noticed that your websocket.html file seems to use the 8383 port somehow.
Sorry if this is a dumb question. If there is an easy answer, please email me at babraham42@gmail.com Thanks!