googollee / go-socket.io

socket.io library for golang, a realtime application framework.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support "extraHeaders" in client

sagan opened this issue · comments

Is your feature request related to a problem? Please describe.
Some socket.io servers require additional header exists in incoming connection, typically for authorization. Socket.io JavaScript client has extraHeaders option for it. However, there is no way to setup additional header of client using go-socket.io.

Describe the solution you'd like
Change the signature of func (c *Client) Connect() to func (c *Client) Connect(extraHeaders http.Header)

func (c *Client) Connect(extraHeaders http.Header) error {
        // ...omit
	enginioCon, err := dialer.Dial(c.url, extraHeaders)
        // ...omit
}

Describe alternatives you've considered
Alternatively, change the engineio.Options struct, add a new extraHeaders field and use it when client do dialing.

Any update over this? or any suggestions?