Skip to content

Commit 5df7d82

Browse files
committed
Fix some stuff
Make send functions take references, etc
1 parent 60aa7d4 commit 5df7d82

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22

33
name = "websocket"
4-
version = "0.6.0"
4+
version = "0.6.1"
55
authors = ["cyderize <[email protected]>"]
66

77
description = "A WebSocket (RFC6455) library for Rust."

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Rust-WebSocket attempts to provide a framework for WebSocket connections (both c
1010
To add a library release version from [crates.io](https://crates.io/crates/websocket) to a Cargo project, add this to the 'dependencies' section of your Cargo.toml:
1111

1212
```INI
13-
websocket = "~0.6.0"
13+
websocket = "~0.6.1"
1414
```
1515

1616
To add the library's Git repository to a Cargo project, add this to your Cargo.toml:

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
//! let response = WebSocketResponse::new::<String>(key.as_slice(), None);
4242
//!
4343
//! // Send the response to the client
44-
//! let _ = client.send_handshake_response(response);
44+
//! let _ = client.send_handshake_response(&response);
4545
//!
4646
//! // Now we can send and receive messages
4747
//! let receiver = client.receiver();

src/ws/client.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ use std::clone::Clone;
2222
/// let stream = TcpStream::connect(request.host().unwrap().as_slice()).unwrap();
2323
///
2424
/// let mut client = WebSocketClient::new(stream, true);
25+
/// let _ = client.send_handshake_request(&request);
2526
/// let response = client.receive_handshake_response().unwrap();
2627
///
2728
/// if !response.is_successful(key) {
@@ -73,14 +74,14 @@ impl<S: Stream + Clone> WebSocketClient<S> {
7374

7475
/// Sends the specified WebSocketRequest to the remote endpoint. Only to be used if the server is
7576
/// the remote endpoint and the client is the local endpoint.
76-
pub fn send_handshake_request(&mut self, request: WebSocketRequest) -> IoResult<()> {
77-
self.stream.write_websocket_request(&request)
77+
pub fn send_handshake_request(&mut self, request: &WebSocketRequest) -> IoResult<()> {
78+
self.stream.write_websocket_request(request)
7879
}
7980

8081
/// Sends the specified WebSocketResponse to this client. Only to be used if the server is
8182
/// the local endpoint and the client is the remote endpoint.
82-
pub fn send_handshake_response(&mut self, response: WebSocketResponse) -> IoResult<()> {
83-
self.stream.write_websocket_response(&response)
83+
pub fn send_handshake_response(&mut self, response: &WebSocketResponse) -> IoResult<()> {
84+
self.stream.write_websocket_response(response)
8485
}
8586

8687
/// Returns a WebSocketSender from this client. Used to transmit data to the remote endpoint,

0 commit comments

Comments
 (0)