I use this code but cant get ip address . How can i get user ip/port address ? I can get socket id with Id(). Below code work well but i cant find how can use more option and function for so variable.
package main
import (
"log"
"net/http"
"github.com/googollee/go-socket.io"
)
func main() {
server, err := socketio.NewServer(nil)
if err != nil {
log.Fatal(err)
}
log.Println("server", server)
server.On("connection", func(so socketio.Socket) {
log.Println("so------->> " ,so )
log.Println("id------->> " , so.Id() )
log.Println("on connection")
so.On("chat message", func(msg string) {
log.Println("emit:", so.Emit("chat message", msg))
so.BroadcastTo("chat", "chat message", msg)
})
so.On("disconnection", func() {
log.Println("on disconnect")
})
})
server.On("error", func(so socketio.Socket, err error) {
log.Println("error:", err)
})
http.Handle("/socket.io/", server)
log.Println("Serving at localhost:5555...")
log.Fatal(http.ListenAndServe(":5555", nil))
}