1package wray 2 3import ( 4 "errors" 5) 6 7type Transport interface { 8 isUsable(string) bool 9 connectionType() string 10 send(map[string]interface{}) (Response, error) 11 setUrl(string) 12} 13 14func SelectTransport(client *FayeClient, transportTypes []string, disabled []string) (Transport, error) { 15 for _, transport := range registeredTransports { 16 if contains(transport.connectionType(), transportTypes) && transport.isUsable(client.url) { 17 return transport, nil 18 } 19 } 20 return nil, errors.New("No usable transports available") 21} 22