Comment on IDEA to make this site standout why don't you make a live chatbox for people who have logged in?
hendrik@palaver.p3x.de 4 days agoYou'd need to change the idea a lot and make it more specific. This way it's not a good way. A local instance chat might be useful for some things. But then this is a platform to discuss underneath posts in communities. So we can already talk to each other...
Allah@lemm.ee 4 days ago
yes i meant separate instance also we just have to put this, dark souls wiki also uses it
You don’t need to rewrite the whole page—just inject the pieces for Socket .io and your chat UI where indicated. Here’s exactly what to add or change in existing HTML (THIS PAGE):
1. Include Socket.IO on the client
Find the closing
</head>
tag and just before it insert:2. Add the chat HTML
Find the closing
</body>
tag and just before it paste:3. Wire up the client-side JavaScript
Right below that (still before
</body>
), add:4. Ensure your server is serving this page and Socket.IO
On your Node/Express server (the same one you use to serve the Lemmy/lemm.ee front-end), you need to:
Install Socket.IO:
npm install socket.io
Hook it up to your HTTP server (roughly as in the example I shared before), making sure you share sessions so only logged-in users connect.
The minimal changes in your
server.js
(or equivalent) are:Summary of “what changed” in your HTML
<script src=“/socket.io/socket.io.js”>
+ minimal CSS<div id=“chat-container”>…</div>
chat widget<script>…</script>
block to wire upio()
With those three small patches, your existing site will host a floating chat box that’s only usable by authenticated users. Let me know if you need help wiring up the session middleware or adjusting the styles!
hendrik@palaver.p3x.de 4 days ago
this uses cargo and Rust. Not npm and NodeJS... I mean go ahead and try, this is an entirely different programming language.