-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move maxFrameSize into configuration type
- Loading branch information
1 parent
4a91504
commit cc78bdb
Showing
7 changed files
with
91 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
Sources/HummingbirdWebSocket/Client/WebSocketClientConfiguration.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// This source file is part of the Hummingbird server framework project | ||
// | ||
// Copyright (c) 2023-2024 the Hummingbird authors | ||
// Licensed under Apache License v2.0 | ||
// | ||
// See LICENSE.txt for license information | ||
// See hummingbird/CONTRIBUTORS.txt for the list of Hummingbird authors | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
import HTTPTypes | ||
|
||
public struct WebSocketClientConfiguration: Sendable { | ||
/// Max websocket frame size that can be sent/received | ||
public var maxFrameSize: Int | ||
/// Additional headers to be sent with the initial HTTP request | ||
public var additionalHeaders: HTTPFields | ||
|
||
/// Initialize WebSocketClient configuration | ||
/// - Paramters | ||
/// - maxFrameSize: Max websocket frame size that can be sent/received | ||
/// - additionalHeaders: Additional headers to be sent with the initial HTTP request | ||
public init( | ||
maxFrameSize: Int = (1 << 14), | ||
additionalHeaders: HTTPFields = .init() | ||
) { | ||
self.maxFrameSize = maxFrameSize | ||
self.additionalHeaders = additionalHeaders | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
Sources/HummingbirdWebSocket/Server/WebSocketServerConfiguration.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// This source file is part of the Hummingbird server framework project | ||
// | ||
// Copyright (c) 2023-2024 the Hummingbird authors | ||
// Licensed under Apache License v2.0 | ||
// | ||
// See LICENSE.txt for license information | ||
// See hummingbird/CONTRIBUTORS.txt for the list of Hummingbird authors | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
/// Configuration for a WebSocket server | ||
public struct WebSocketServerConfiguration: Sendable { | ||
/// Max websocket frame size that can be sent/received | ||
public var maxFrameSize: Int | ||
|
||
/// Initialize WebSocketClient configuration | ||
/// - Paramters | ||
/// - maxFrameSize: Max websocket frame size that can be sent/received | ||
/// - additionalHeaders: Additional headers to be sent with the initial HTTP request | ||
public init( | ||
maxFrameSize: Int = (1 << 14) | ||
) { | ||
self.maxFrameSize = maxFrameSize | ||
} | ||
} |