summaryrefslogblamecommitdiffstats
path: root/vendor/github.com/mrexodia/wray/transport.go
blob: 82f4d4d34f852d5b5f605e0c10ae23ee88e528cc (plain) (tree)



















                                                                                                           
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")
}