Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
G-MAKROGLOU authored Jul 17, 2024
1 parent 6450cbc commit f6b7910
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ import "fmt"
type CustomEvents struct {}

func (c CustomEvents) OnStartError(err error) {
fmt.Println("[SERVER] Failed to start ", err)
fmt.Println("[SERVER] Failed to start ", err)
}

func (c CustomEvents) OnSend(data map[string]interface{}) {
b, _ := json.MarshalIndent(data, "", " ")

fmt.Println("[SERVER] SENT: ", string(b))
fmt.Println("[SERVER] SENT: ", string(b))
}

func (c CustomEvents) OnSendError(err error) {
fmt.Println("[SERVER] Failed to send ", err)
fmt.Println("[SERVER] Failed to send ", err)
}
```

Expand All @@ -28,17 +28,17 @@ func (c CustomEvents) OnSendError(err error) {
package main

import (
"fmt"
server "github.com/G-MAKROGLOU/websocket-server"
"fmt"
server "github.com/G-MAKROGLOU/websocket-server"
)

func main() {
port := ":5000"
path := "/ws"
s := server.NewSocketServer(path, port, CustomEvents{});
s := server.NewSocketServer(path, port, CustomEvents{});

if err := s.Start(); err != nil {
fmt.Println("Failed to start socket server: ", err)
}
if err := s.Start(); err != nil {
fmt.Println("Failed to start socket server: ", err)
}
}
```

0 comments on commit f6b7910

Please sign in to comment.