Skip to content

Sending incorrect json to wsjson.Read closes connection #399

@minzanupam

Description

@minzanupam

I don't know where this is intended or not but it seem that sending incorrect json data to wsjson.Read closes the websocket connection even though an error object is returned.

Incorrect json data like

{
  "message": "hello world"
} something

Here a part of my code

var v interface{}
for {
    err = wsjson.Read(ctx, ws, &v)
    if err != nil {
        log.Println(err)
        continue
    }
    log.Println(v)
}

I was trying to continue using the connect in spite of error however this causes the connection to close and an infinite loop to run continuously printing the error.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions