Skip to content

Commit 4689cc1

Browse files
committed
socket.io server communication from main process to express app
1 parent ce72e1a commit 4689cc1

File tree

5 files changed

+656
-162
lines changed

5 files changed

+656
-162
lines changed

dist/views/include/head.ejs

+14
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,18 @@
22
<meta charset="utf-8" />
33
<title><%= title %></title>
44
<link rel="stylesheet" href="stylesheets/style.css" />
5+
<script type="module">
6+
import { io } from "http://cdn.socket.io/4.8.0/socket.io.esm.min.js";
7+
8+
const socket = io('http://localhost:3001');
9+
10+
socket.on('connect', () => {
11+
console.log('Connected to server');
12+
socket.emit('hello');
13+
});
14+
15+
socket.on('hello', (message) => {
16+
console.log(message);
17+
});
18+
</script>
519
</head>

0 commit comments

Comments
 (0)