5
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2024-11-23 11:41:35 +00:00
matterbridge/vendor/github.com/mrexodia/wray/transport.go

22 lines
520 B
Go
Raw Normal View History

2016-09-04 18:03:07 +00:00
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")
}