Skip to content
This repository was archived by the owner on Apr 7, 2022. It is now read-only.
This repository was archived by the owner on Apr 7, 2022. It is now read-only.

Working with async functions #350

@grahamburgsma

Description

@grahamburgsma

Since the rest of Vapor is very asynchronous with many tasks returning futures, it makes it difficult to work with web sockets. Maybe this just requires more examples in the documentation, though it would be nice if web sockets got some love like the rest of Vapor.

If you need to do a query in one of the following examples, there is no where to return the future. I've run in to leaking promises and other issues because of this.

func onUpgrade(ws: WebSocket, req: Request) throws
ws.onText { (ws, text) in
    // no where to return future
}

Could this get addressed in Vapor 4?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions