Skip to content

Commit

Permalink
feat: added socket handler functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Bikram-ghuku committed Jul 1, 2024
1 parent 916e67b commit b24ff3d
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion socketServer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,23 @@ import (
"github.com/joho/godotenv"
)

var (
server *socketio.Server
)

func Handler() {
server.OnConnect("/", func(c socketio.Conn) error {
fmt.Println("A new User conencted: ", c.ID())
return nil
})
server.OnEvent("/", "message", func(s socketio.Conn, msg string) {

})
}

func main() {
godotenv.Load()
server := socketio.NewServer(nil)
server = socketio.NewServer(nil)

port := os.Getenv("PORT")

Expand Down

0 comments on commit b24ff3d

Please sign in to comment.