Check out this basic pug file snippet:
p Hello
The back end consists of typical components such as node, express, passport, and sql. You can set up a route like this:
app.get('/example', (request, response) => {
response.render('example.pug');
})
Here's what I want the web page to do:
Establish a connection with a websocket server
Display any incoming text in place of the 'Hello' message
Any suggestions on how to achieve this?
(Just for reference, the server side functions look something like this ... Implementing that part is not an issue.)
function sendInfoToAnyBrowserConnected() {
connections.forEach(function tell(c) {
if (c.readyState == WebSocket.OPEN) {
c.send("this text gets displayed")
What content should be included in my pug file?