Skip to content

Instantly share code, notes, and snippets.

@ghaffaru
Last active November 25, 2020 14:47
Show Gist options
  • Select an option

  • Save ghaffaru/7a159c8f8ce9fd55d28a9329786eb677 to your computer and use it in GitHub Desktop.

Select an option

Save ghaffaru/7a159c8f8ce9fd55d28a9329786eb677 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Socket Test</title>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.6.10/vue.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.3.1/socket.io.js"></script>
</head>
<body>
<div id="app">
</div>
<script>
const socket = io("http://localhost:4000", {transports: ['websocket'], upgrade: false});
let vue = new Vue({
el: "#app",
mounted() {
socket.on('connect', () => {
socket.emit("user-at-jobSite", {
memberId: "5fabe8d677dff916ba7bde5f",
jobSiteId: "5fad3bb214921641993da3dc",
latitude: 5.668124,
longitude: -0.177345
})
})
}
})
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment