Go - NewWebsocket()
Creates a new Websocket.
import (
"fmt"
"github.com/nitrictech/go-sdk/nitric"
)
func main() {
ws, err := nitric.NewWebsocket("public")
if err != nil {
return
}
if err := nitric.Run(); err != nil {
fmt.Println(err)
}
}
Parameters
- Name
name
- Required
- Required
- Type
- string
- Description
The unique name of this Websocket within the app. Subsequent calls to
NewWebsocket
with the same name will return the same object.
Examples
Create a Websocket
import (
"fmt"
"github.com/nitrictech/go-sdk/nitric"
)
func main() {
ws, err := nitric.NewWebsocket("public")
if err != nil {
return
}
if err := nitric.Run(); err != nil {
fmt.Println(err)
}
}