Skip to content

Commit

Permalink
Fix websocket for popup chat
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthiasReumann committed Aug 22, 2023
1 parent 8b29afe commit dc8e56f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion web/template/popup-chat.gohtml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
<link href="/static/assets/css-dist/home.css?v={{if .IndexData.VersionTag}}{{.IndexData.VersionTag}}{{else}}development{{end}}"
rel="stylesheet">
</head>
<body class="bg-white dark:bg-secondary h-screen">
<body class="bg-white dark:bg-secondary h-screen" x-data="interaction.popupContext({{$stream.ID}})">
{{template "chat-component" .}}
</body>
11 changes: 11 additions & 0 deletions web/ts/components/popup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { AlpineComponent } from "./alpine-component";
import { RealtimeFacade } from "../utilities/ws";
import { SocketConnections } from "../api/chat-ws";

export function popupContext(streamId: number): AlpineComponent {
return {
init() {
SocketConnections.ws = new RealtimeFacade("chat/" + streamId);
},
} as AlpineComponent;
}
1 change: 1 addition & 0 deletions web/ts/entry/interactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ export * from "../components/chat-prompt";
export * from "../components/poll";
export * from "../components/emoji-picker";
export * from "../components/video-information";
export * from "../components/popup";

0 comments on commit dc8e56f

Please sign in to comment.