wip adding web socket with nest

This commit is contained in:
simplonco
2022-12-28 14:53:05 +01:00
parent da8c7f33c8
commit ead4a1c264
12 changed files with 464 additions and 113 deletions

View File

@@ -13,17 +13,27 @@
import MuteLayout from './Layout_mute.svelte';
import UserLayout from './Layout_user.svelte';
/* web sockets with socket.io
*/
import { onMount } from 'svelte';
import io from 'socket.io-client';
const socket = io('http://transcendance:8080/api/v2');
onMount(async => {
socket.on('connect', () => {
console.log("client connection");
});
});
/* global variables
*/
export let color = "transparent";
let room = "";
let admin = false;
let layout = "close";
let layouts = ["home", "home"];
// hold previous version of layout, to go back
/* hold previous version of layout, to go back
*/
function set_layouts(layout)
{
if (layout === "close")
@@ -34,7 +44,6 @@
layouts = [layout, "home"];
else
layouts = [layout, layouts[0]];
console.log(layouts);
}
$: set_layouts(layout);

View File

@@ -21,7 +21,6 @@
function update_layout() {
layout = new_layout;
console.log(layout);
}
</script>

View File

@@ -22,7 +22,6 @@
function send_msg()
{
msg = msg.trim();
console.log(msg);
if (msg.length > 0) {
//socket.emit('sendmsg', msg);