Go is in development for v1. Interested in contributing or chatting with us?Get in touch!
Go - Websocket.Details()
Retrieve details about the deployed Websocket at runtime. These details include:
ID
: the identifier for the resource.Provider
: the cloud provider that this Websocket is deployed to.Service
: the cloud service that is running this Websocket (i.e. AWS API Gateway).URL
: the URL of the deployed Websocket.
import (
"fmt"
"context"
"github.com/nitrictech/go-sdk/nitric"
)
func main() {
ws, err := nitric.NewWebsocket("public")
if err != nil {
return
}
details, err := ws.Details(context.TODO())
if err != nil {
return
}
if err := nitric.Run(); err != nil {
fmt.Println(err)
}
}
Parameters
- Name
ctx
- Required
- Required
- Type
- context
- Description
The context of the call, used for tracing.
Examples
Get the URL of a deployed Websocket
import (
"fmt"
"context"
"github.com/nitrictech/go-sdk/nitric"
)
func main() {
ws, err := nitric.NewWebsocket("public")
if err != nil {
return
}
details, err := ws.Details(context.TODO())
if err != nil {
return
}
fmt.Println(details.URL)
if err := nitric.Run(); err != nil {
fmt.Println(err)
}
}