feat(wetsock) basic web socket server setup

This commit is contained in:
Benjamin Wegener
2024-04-02 23:22:46 +00:00
parent d161d8826e
commit 9147658f30
3 changed files with 4 additions and 4 deletions

0
.gitignore vendored Normal file
View File

View File

@@ -7,7 +7,7 @@ const server = Bun.serve({
port: process.env.APP_PORT || 43_069,
fetch(req, server) {
const url = new URL(req.url);
if(url.pathname == '/chat') return wetsock.handleFetch(req, server);
if(url.pathname == '/chat') return wetsock.handleUpgrade(req, server);
if(url.pathname == '/client.js') {
const filePath = resolve(__dirname, 'WetSock', 'Client', 'Client.js');

View File

@@ -2,7 +2,6 @@
<html>
<head>
<title>WetSock Client Test</title>
<script src="/wetsock-client.js"></script>
<style>
/* Add some basic styling */
body {
@@ -52,8 +51,9 @@
<h2>Output:</h2>
<div id="output"></div>
<script>
const client = new WetSockClient('ws://wetsock.ghosted.id:80/chat');
<script type="module">
import WetSockClient from './client.js';
const client = new WetSockClient('wss://wetsock.ghosted.id:443/chat');
const pluginIdentifierSelect = document.getElementById('pluginIdentifier');
const actionNameSelect = document.getElementById('actionName');
const entityIdInput = document.getElementById('entityId');