New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rename read/write to send/receive #1603
Changes from all commits
5818177
ea15b13
41b4db1
a311b7c
eda3197
cb667d4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,9 +17,8 @@ package object websocket { | |
/** | ||
* Build a response which will accept an HTTP websocket upgrade request and initiate a websocket connection using the | ||
* supplied exchange to process and respond to websocket messages. | ||
* @param read The read side of the Exchange represents the stream of messages that should be sent to the client | ||
* @param write The write side of the Exchange is a sink to which the framework will push the websocket messages | ||
* received from the client. | ||
* @param send The send side of the Exchange represents the outgoing stream of messages that should be sent to the client | ||
* @param receive The receive side of the Exchange is a sink to which the framework will push the incoming websocket messages | ||
* Once both streams have terminated, the server will initiate a close of the websocket connection. | ||
* As defined in the websocket specification, this means the server | ||
* will send a CloseFrame to the client and wait for a CloseFrame in response before closing the | ||
|
@@ -40,13 +39,13 @@ package object websocket { | |
* @param status The status code to return to a client making a non-websocket HTTP request to this route | ||
*/ | ||
def WS[F[_]]( | ||
read: Stream[F, WebSocketFrame], | ||
write: Sink[F, WebSocketFrame], | ||
send: Stream[F, WebSocketFrame], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @aeons I'm unsure how to handle the deprecation here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think we can in this case. It'll break for people using named arguments, but at least the types are unique. I think it'll be okay. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 to this as well. It should be a simple fix for users. |
||
receive: Sink[F, WebSocketFrame], | ||
status: F[Response[F]])(implicit F: Functor[F]): F[Response[F]] = | ||
status.map(_.withAttribute(AttributeEntry(websocketKey[F], Websocket(read, write)))) | ||
status.map(_.withAttribute(AttributeEntry(websocketKey[F], Websocket(send, receive)))) | ||
|
||
def WS[F[_]](read: Stream[F, WebSocketFrame], write: Sink[F, WebSocketFrame])( | ||
def WS[F[_]](send: Stream[F, WebSocketFrame], receive: Sink[F, WebSocketFrame])( | ||
implicit F: Monad[F], | ||
W: EntityEncoder[F, String]): F[Response[F]] = | ||
WS(read, write, Response[F](Status.NotImplemented).withBody("This is a WebSocket route.")) | ||
WS(send, receive, Response[F](Status.NotImplemented).withBody("This is a WebSocket route.")) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can the deprecation be versioned here?