Will
Will

Reputation: 75615

Serving web-sockets and web-pages from the same port

Using Java's Netty, can you serve HTTP requests and web-sockets from the same port?

I thought that the whole point of using HTTP "upgrade" for web-sockets was to make this so.

But I can't find even a clear simple example of a web-socket server in Netty, let alone how to mix it into an HTTP server. (The websocket example puts all its effort into serving a favicon to non-websocket connections and omits actually having much of a conversation with a client.)

Upvotes: 3

Views: 498

Answers (1)

forty-two
forty-two

Reputation: 12817

Hmm, something makes me think you didn't read the example thoroughly enough. It

  1. demonstrates combination of regular HtTTP requests and websocket requests
  2. it does not serve the favicon resource (it returns 404 Not Found), and
  3. exchande websocket text frames with the client

Upvotes: 2

Related Questions