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, port: process.env.APP_PORT || 43_069,
fetch(req, server) { fetch(req, server) {
const url = new URL(req.url); 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') { if(url.pathname == '/client.js') {
const filePath = resolve(__dirname, 'WetSock', 'Client', 'Client.js'); const filePath = resolve(__dirname, 'WetSock', 'Client', 'Client.js');

View File

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