Skip to content

Commit 2fd0dfc

Browse files
committed
Implementation WebSocketChannel Using StarScream.
1 parent 93e61c8 commit 2fd0dfc

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

Sources/StompClientKit/StompClient.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ public class StompClient: WebSocketChannelDelegate {
235235
public func send(frame: inout Frame, using encoding: String.Encoding? = .utf8) {
236236

237237
// support transaction
238-
if (transaction == nil) {
238+
if (transaction != nil) {
239239
frame.addHeader(FrameHeader(k: Headers.TRANSACTION.rawValue, v: transaction!.trxId))
240240
}
241241

Sources/StompClientKit/WebSocketChannel.swift

+14-4
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import Foundation
1313
* another Websocket library. Future versions of StompClientKit may add new Websocket libraries.
1414
*/
1515
public protocol WebSocketChannel: class {
16-
16+
1717
/**
1818
* Build a new channel using a Websocket URL .
1919
*/
@@ -50,12 +50,22 @@ public protocol WebSocketChannel: class {
5050
var delegate: WebSocketChannelDelegate { get set}
5151
}
5252

53-
/**
54-
*
55-
*/
53+
54+
/// WebSocketChannelDelete
55+
/// defines callbacks when Websocket event occoured.
5656
public protocol WebSocketChannelDelegate {
57+
58+
/// Callbak after websocket channel connected
5759
func onChannelConnected()
60+
61+
/// Call back after websocket channel disconnected
5862
func onChannelDisConnected()
63+
64+
/// Text handler
65+
/// - Parameter text: Text that received from websocket server.
5966
func onText(received text: String)
67+
68+
/// Error handler
69+
/// - Parameter error: <#error description#>
6070
func onChannelError(_ error: Error)
6171
}

0 commit comments

Comments
 (0)