Ability to read websocket join messages

This commit is contained in:
Paul-Henri Froidmont 2025-08-23 01:42:56 +02:00
parent aae3db841b
commit fadef26425
Signed by: phfroidmont
GPG key ID: BE948AFD7E7873BE
8 changed files with 158 additions and 52 deletions

View file

@ -1,3 +1,27 @@
import { scalive } from "core/js/index"
import { Socket } from "phoenix"
import { LiveSocket } from "phoenix_live_view"
// import topbar from "../vendor/topbar"
// import Calendar from "./hooks/calendar"
console.log(scalive)
// let csrfToken =
// document.querySelector("meta[name='csrf-token']").getAttribute("content")
let liveSocket = new LiveSocket("/live", Socket, {
// params: { _csrf_token: csrfToken },
// hooks: Hooks
});
// Show progress bar on live navigation and form submits
// topbar.config({ barColors: { 0: "#29d" }, shadowColor: "rgba(0, 0, 0, .3)" })
// window.addEventListener("phx:page-loading-start", info => topbar.delayedShow(200))
// window.addEventListener("phx:page-loading-stop", info => topbar.hide())
// connect if there are any LiveViews on the page
liveSocket.connect()
// expose liveSocket on window for web console debug logs and latency simulation:
// >> liveSocket.enableDebug()
// >> liveSocket.enableLatencySim(1000) // enabled for duration of browser session
// >> liveSocket.disableLatencySim()
window.liveSocket = liveSocket

1
example/js/src/dummy.ts Normal file
View file

@ -0,0 +1 @@
// At least one ts files is needed so that mill doesn't set files in tsconfig.json to an empty array.