go-mojito / mojito

Code your next Go web project with (a) Mojito! Mojito is a super-modular, fast, opinion-less framework to bootstrap your next Go web project.
https://go-mojito.infinytum.co
MIT License
24 stars 0 forks source link

[Bug]: websocket.Context.Closed() undefined #56

Closed rlsvr closed 1 year ago

rlsvr commented 1 year ago

Description

go run main.go

command-line-arguments

./main.go:9:11: ctx.Closed undefined (type "github.com/go-mojito/mojito/websocket".Context has no field or method Closed)

How to Reproduce

  1. Run the code snippet

Expected Behavior

Able to compile.

Version

0.0.16

Code Snippet

package main

import "github.com/go-mojito/mojito"
import websocket "github.com/go-mojito/mojito/websocket"

func SomeHandler(ctx websocket.Context) {
    for !ctx.Closed() {
        var msg string
        ctx.Receive(&msg)
        ctx.Send(msg)
    }
}

func main() {
  mojito.GET("/", func(ctx mojito.Context) {
    ctx.String("Hello World")
  })
  mojito.GET("/ws", SomeHandler)
  mojito.ListenAndServe(":8123")
}

Checklist:

nilathedragon commented 1 year ago

Thank you for reporting, I was able to reproduce this issue and a fix is in progress!

nilathedragon commented 1 year ago

I have created a new release v0.0.17 which contains the fix

rlsvr commented 1 year ago

Thank you!