websockets-rs / websockets-rs/rust-websocket

Example for HyperResponse doesn't compile

Open
#173 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
1.6k
Forks
225
PR merge metrics
No merged PRs in 30d

Description

Hello!

I attempted to compile the HyperResponse example (http://cyderize.github.io/rust-websocket/doc/websocket/server/upgrade/sync/struct.HyperRequest.html) with current Hyper, but it doesn't type check.

error[E0599]: no function or associated item named `http` found for type `hyper::Server<_, _>` in the
current scope
 --> src/server/mod.rs:7:5
  |
7 |     Server::http("0.0.0.0:80")
  |     ^^^^^^^^^^^^ function or associated item not found in `hyper::Server<_, _>`

error[E0308]: mismatched types
  --> src/server/mod.rs:10:32
   |
10 |             match HyperRequest(req).into_ws() {
   |                                ^^^ expected struct `hyper::server::request::Request`, found struc
t `hyper::Request`
   |
   = note: expected type `hyper::server::request::Request<'_, '_>`
              found type `hyper::Request`

error[E0599]: no method named `send` found for type `hyper::Response` in the current scope
  --> src/server/mod.rs:23:25
   |
23 |                     res.send(b"Try connecting over ws instead.").unwrap();
   |                         ^^^^

error: aborting due to 3 previous errors

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the HyperResponse example linked in the issue and the reported src/server/mod.rs locations, then compile it against the current Hyper API. Done means the example type-checks without the three reported errors and still demonstrates the intended WebSocket upgrade behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.