vapor-docs/3.0/docs/sockets/package.md

784 B

Using Sockets

Sockets is a library containing all Socket related APIs.

With Vapor

This package is included with Vapor by default, just add:

import Sockets

Without Vapor

To include it in your package, add the following to your Package.swift file.

// swift-tools-version:4.0
import PackageDescription

let package = Package(
    name: "Project",
    dependencies: [
        ...
        .package(url: "https://github.com/vapor/sockets.git", .upToNextMajor(from: "3.0.0")),
    ],
    targets: [
      .target(name: "Project", dependencies: ["Sockets", ... ])
    ]
)

If this is your first time adding a dependency, you should read our introduction to Package.swift.

Use import Sockets to access Sockets's APIs.