Sublimation

SublimationService

使用 Sublimation 作为 Lifecycle Service,用于诸如 Hummingbird 等应用程序。

SwiftPM Twitter GitHub GitHub issues GitHub Workflow Status

Codecov CodeFactor Grade codebeat badge Code Climate maintainability Code Climate technical debt Code Climate issues

目录

要求

Apple 平台

Linux

安装

要使用 SPM 将 SublimationService 集成到您的应用程序中,请在您的 Package.swift 文件中指定它

let package = Package(
  ...
  dependencies: [
    .package(url: "https://github.com/brightdigit/SublimationService.git", from: "1.0.0")
  ],
  targets: [
      .target(
          name: "YourServerApp",
          dependencies: [
            .product(name: "SublimationService", package: "SublimationService"), ...
          ]),
      ...
  ]
)

用法

例如,如果您将它与 Hummingbird 一起使用,并使用 Bonjour,您可以将其直接添加为服务

let sublimation = Sublimation(
  bindingConfiguration: .init(
    hosts: hosts, 
    configuration: configuration.hosting
  )
)

var app = Application(
  router: router,
  server: .http1WebSocketUpgrade(webSocketRouter: wsRouter),
  configuration: .init(address: .init(setup: configuration.hosting))
)

app.addServices(sublimation)

文档

要了解更多信息,请查看完整的文档

许可

此代码在 MIT 许可证下分发。 有关更多信息,请参阅 LICENSE 文件。