forked from lug/matterbridge
Add Gitter support
This commit is contained in:
21
vendor/github.com/mrexodia/wray/transport.go
generated
vendored
Normal file
21
vendor/github.com/mrexodia/wray/transport.go
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
package wray
|
||||
|
||||
import (
|
||||
"errors"
|
||||
)
|
||||
|
||||
type Transport interface {
|
||||
isUsable(string) bool
|
||||
connectionType() string
|
||||
send(map[string]interface{}) (Response, error)
|
||||
setUrl(string)
|
||||
}
|
||||
|
||||
func SelectTransport(client *FayeClient, transportTypes []string, disabled []string) (Transport, error) {
|
||||
for _, transport := range registeredTransports {
|
||||
if contains(transport.connectionType(), transportTypes) && transport.isUsable(client.url) {
|
||||
return transport, nil
|
||||
}
|
||||
}
|
||||
return nil, errors.New("No usable transports available")
|
||||
}
|
||||
Reference in New Issue
Block a user