mirror of
https://github.com/nestjs/nest.git
synced 2026-02-21 23:11:44 +00:00
refactor(@nestjs) rename directories, add script, fix tests
This commit is contained in:
22
sample/02-gateways/client/index.html
Normal file
22
sample/02-gateways/client/index.html
Normal file
@@ -0,0 +1,22 @@
|
||||
<html>
|
||||
<head>
|
||||
<script src="socket.io.js"></script>
|
||||
<script>
|
||||
const socket = io('http://localhost:3000');
|
||||
socket.on('connect', function() {
|
||||
console.log('Connected');
|
||||
socket.emit('events', { test: 'test' });
|
||||
});
|
||||
socket.on('events', function(data) {
|
||||
console.log('event', data);
|
||||
});
|
||||
socket.on('exception', function(data) {
|
||||
console.log('event', data);
|
||||
});
|
||||
socket.on('disconnect', function() {
|
||||
console.log('Disconnected');
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
||||
8201
sample/02-gateways/client/socket.io.js
Normal file
8201
sample/02-gateways/client/socket.io.js
Normal file
File diff suppressed because it is too large
Load Diff
18
sample/02-gateways/client/ws.html
Normal file
18
sample/02-gateways/client/ws.html
Normal file
@@ -0,0 +1,18 @@
|
||||
<html>
|
||||
<head>
|
||||
<script>
|
||||
const socket = new WebSocket('ws://localhost:81');
|
||||
socket.onopen = function() {
|
||||
console.log('Connected');
|
||||
socket.send(JSON.stringify({
|
||||
type: 'events',
|
||||
message: 'test',
|
||||
}));
|
||||
socket.onmessage = function(data) {
|
||||
console.log(data);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user