Example #1
0
func (t *inprocTran) NewListener(addr string, sock mangos.Socket) (mangos.PipeListener, error) {
	if _, err := mangos.StripScheme(t, addr); err != nil {
		return nil, err
	}
	l := &listener{addr: addr, proto: sock.GetProtocol()}
	return l, nil
}
Example #2
0
func (t wsTran) NewListener(addr string, sock mangos.Socket) (mangos.PipeListener, error) {
	proto := sock.GetProtocol()
	l, e := t.listener(addr, proto)
	if e == nil {
		if v, e := sock.GetOption(mangos.OptionMaxRecvSize); e == nil {
			l.maxrx = v.(int)
		}
		l.mux.Handle(l.url.Path, l)
	}
	return l, e
}
Example #3
0
func (wsTran) NewDialer(addr string, sock mangos.Socket) (mangos.PipeDialer, error) {
	iswss := strings.HasPrefix(addr, "wss://")
	opts := make(map[string]interface{})

	opts[mangos.OptionNoDelay] = true
	opts[mangos.OptionKeepAlive] = true
	proto := sock.GetProtocol()
	maxrx := 0
	if v, e := sock.GetOption(mangos.OptionMaxRecvSize); e == nil {
		maxrx = v.(int)
	}

	return &dialer{addr: addr, proto: proto, iswss: iswss, opts: opts, maxrx: maxrx}, nil
}
Example #4
0
func (t *inprocTran) NewDialer(addr string, sock mangos.Socket) (mangos.PipeDialer, error) {
	if _, err := mangos.StripScheme(t, addr); err != nil {
		return nil, err
	}
	return &dialer{addr: addr, proto: sock.GetProtocol()}, nil
}