Skip to content

Instantly share code, notes, and snippets.

@alexcastillo
Created June 20, 2017 04:50
Show Gist options
  • Save alexcastillo/e3aca7ba0a3510a4c340b34faeb6d54c to your computer and use it in GitHub Desktop.
Save alexcastillo/e3aca7ba0a3510a4c340b34faeb6d54c to your computer and use it in GitHub Desktop.
Socket.io client
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Socket.io Client</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="//cdn.jsdelivr.net/socket.io-client/1.3.2/socket.io.js" />
<script>
var socket = io('http://0.0.0.0:0000'); // ip of wifi shield and port of socket
socket.on('data', function (data) {
console.log(data);
});
</script>
</head>
<body>
Check the console
</body>
</html>
@andrewjaykeller
Copy link

Here is the error i'm getting:
screen shot 2017-06-20 at 8 46 52 pm

@andrewjaykeller
Copy link

needed to add a end script tag on <script src="//cdn.jsdelivr.net/socket.io-client/1.3.2/socket.io.js" />

@alexcastillo
Copy link
Author

Are you serving this from the file system or a web server?
Also, can you share your Arduino server request/response headers?

@andrewjaykeller
Copy link

the websocket server is on port 81 not port 80 on the Wifi Shield, i have been trying to hit 81. need to get back on my wifi to test this but i have feeling that was the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment