Skip to content

Commit a8f95b9

Browse files
committed
Move while loop read to own function
1 parent 6e99638 commit a8f95b9

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Sources/WebSockets.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,15 @@ public func websocket(
9494
}
9595
}
9696

97-
do {
97+
func read() throws {
9898
while true {
9999
let frame = try session.readFrame()
100100
try handleOperationCode(frame)
101101
}
102+
}
103+
104+
do {
105+
try read()
102106
} catch let error {
103107
switch error {
104108
case WebSocketSession.Control.close:

0 commit comments

Comments
 (0)