DEV Community

Perm Chao
Perm Chao

Posted on

1

Try using websocket with Go Fiber for the first time

Objective

I want to implement simple chatroom with websocket (in go fiber middleware)


Step (code in every step will be in main.go)

1) make channels for receive commands chan and map channels and user in rooms

chan-and-map

2) write function to receive command from connection

func-listen

3) set endpoint to make connection

set-path

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs