-
Notifications
You must be signed in to change notification settings - Fork 41
/
negotiateresponse.go
33 lines (26 loc) · 1.01 KB
/
negotiateresponse.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package signalr
type TransportType string
var TransportWebSockets TransportType = "WebSockets"
var TransportWebTransports TransportType = "WebTransports"
var TransportServerSentEvents TransportType = "ServerSentEvents"
type TransferFormatType string
var TransferFormatText TransferFormatType = "Text"
var TransferFormatBinary TransferFormatType = "Binary"
type availableTransport struct {
Transport string `json:"transport"`
TransferFormats []string `json:"transferFormats"`
}
type negotiateResponse struct {
ConnectionToken string `json:"connectionToken,omitempty"`
ConnectionID string `json:"connectionId"`
NegotiateVersion int `json:"negotiateVersion,omitempty"`
AvailableTransports []availableTransport `json:"availableTransports"`
}
func (nr *negotiateResponse) hasTransport(transportType TransportType) bool {
for _, transport := range nr.AvailableTransports {
if transport.Transport == string(transportType) {
return true
}
}
return false
}