gofiber / websocket

⚠️ Deprecated repository, available within Fiber Contrib.
https://github.com/gofiber/contrib/tree/main/websocket
MIT License
288 stars 25 forks source link

write error: An established connection was aborted by the software #150

Open loveyandex opened 1 year ago

loveyandex commented 1 year ago

write tcp4 127.0.0.1:4000->127.0.0.1:24754: wsasend: An established connection was aborted by the software in your host machine.

problem

when i open browser first time all is ok ... but by refrreshing it can not be established to connnection and was aborted no data can be exchanged the code for websocker stablishing is talking with rabbitmq task queue

ReneWerner87 commented 1 year ago

Closed because of too little information. The headline should be a short description and not all the information provided.

loveyandex commented 1 year ago

Closed because of too little information. The headline should be a short description and not all the information provided.

u right i will reform it

loveyandex commented 1 year ago
app.Get("/ws/:id", websocket.New(func(c *websocket.Conn) {

//this chan for connection alive
        var forever chan string

        Q, err := ch.Consume(
            qqq.Name, // queue
            "",               // consumer
            false,            // auto-ack
            false,            // exclusive
            false,            // no-local
            false,            // no-wait
            nil,              // args
        )

        for d := range Q{
            b := d.Body
            // log.Printf("msg recv: %s", b)

            if err = c.WriteMessage(1, b); err != nil {
                log.Println("orderbooks write:", err)

            }
        }
        <-forever

    }))