Quellcode durchsuchen

Websocket: Add wrapper to prevent breaking the API

Marking the old method API as deprecated.
Marc Capdevielle vor 8 Jahren
Ursprung
Commit
919ba13f39
1 geänderte Dateien mit 6 neuen und 0 gelöschten Zeilen
  1. 6 0
      Sources/WebSockets.swift

+ 6 - 0
Sources/WebSockets.swift

@@ -7,6 +7,12 @@
 
 import Foundation
 
+@available(*, deprecated, message: "Use websocket(text:binary:pong:connected:disconnected:) instead.")
+public func websocket(_ text: @escaping (WebSocketSession, String) -> Void,
+                      _ binary: @escaping (WebSocketSession, [UInt8]) -> Void,
+                      _ pong: @escaping (WebSocketSession, [UInt8]) -> Void) -> ((HttpRequest) -> HttpResponse) {
+    return websocket(text: text, binary: binary, pong: pong)
+}
 
 public func websocket(
     text: ((WebSocketSession, String) -> Void)? = nil,