Giter Site home page Giter Site logo

Comments (7)

mikelikespie avatar mikelikespie commented on July 17, 2024

I'm not sure how this should be exposed. For now, one can

NSMutableURLRequest *r = [[NSMutableURLRequest alloc] initWithURL:@"ws://example.com/bar"];
[r setValue:@"chat, superchat" forHTTPHeaderField:@"Sec-WebSocket-Protocol"]
// Use r when initializing socket

from socketrocket.

mikelikespie avatar mikelikespie commented on July 17, 2024

@matzew Going to close this issue for now (just doing a bit of cleanup). If you're having trouble with manipulating the NSURLRequest, please let me know.

from socketrocket.

matzew avatar matzew commented on July 17, 2024

@mikelikespie usually the protocols is applied in the constructor (see http://dev.w3.org/html5/websockets/#the-websocket-interface )

Also similar code (java based)
https://github.com/netty/netty/blob/master/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketClientHandshakerFactory.java#L42

and:
https://github.com/netty/netty/blob/master/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketClientHandshaker13.java#L71

from socketrocket.

mikelikespie avatar mikelikespie commented on July 17, 2024

Thanks for pointing that out.

I am considering adding just a second constructor that takes a URL and list of protocols. Would this be sufficient?

from socketrocket.

matzew avatar matzew commented on July 17, 2024

Hey,

see:

matzew@5ed9fe6

that's good enough; I opened a pull request for that;

Cheers!
Matthias

from socketrocket.

mikelikespie avatar mikelikespie commented on July 17, 2024

@matzew Thanks for the pull request. I fixed it slightly differently in ce4fb27 (also, your pull request has a change for the origin stuff too)

Thanks again for the reporting.
-Mike

from socketrocket.

sashakid avatar sashakid commented on July 17, 2024

Hi, is that all about error Error Domain=SRWebSocketErrorDomain Code=2133 "Invalid Sec-WebSocket-Accept response." UserInfo={NSLocalizedDescription=Invalid Sec-WebSocket-Accept response.}?

from socketrocket.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.