zishang520/socket.io

Seems socket.Server.Emit not work?

Closed this issue · 2 comments

Expected:
The postman client should get "server hello..." message but not.
image

Reproduce code:

package main

import (
	"net/http"

	"github.com/go-chi/chi/v5"
	"github.com/go-chi/chi/v5/middleware"
	"github.com/zishang520/socket.io/v2/socket"
)

func main() {
	var r = chi.NewRouter()
	r.Use(middleware.Heartbeat("/ping"))
	var server = socket.NewServer(nil, nil)
	server.On("connection", func(clients ...any) {
		var client = clients[0].(*socket.Socket)
		client.Emit("welcome", "client hello...")
		server.Emit("welcome", "server hello...")
		server.Of("/", nil).Emit("welcome", "root room hello...")
	})
	r.Handle("/socket.io/", server.ServeHandler(nil))
	http.ListenAndServe("localhost:8080", r)
}

Waiting for my survey results.

This issue has been fixed in v2.3.5:

image
image