Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

New feature: Support for WebSocket as protocol #660

Open
osoykan opened this issue Nov 29, 2024 · 0 comments
Open

New feature: Support for WebSocket as protocol #660

osoykan opened this issue Nov 29, 2024 · 0 comments
Assignees
Labels

Comments

@osoykan
Copy link
Collaborator

osoykan commented Nov 29, 2024

We have http protocol to interact with. But users also in the need of having a WebSocket protocol to test their systems.

http system leverages ktor client to make requests against the Application Under Test (AUT). With a little search I have discovered that WebSocket plugin for Ktor client can be easily installed.

https://ktor.io/docs/server-create-websocket-application.html#add-automated-tests

val client = createClient {
 install(ContentNegotiation) {
    json()
 }
 
 install(WebSockets) {
    contentConverter = KotlinxWebsocketSerializationConverter(Json)
 }
}

After enabling WebSockets, we can create an API on HttpSystem to interact with AUTs websocket endpoints.

One example could be (on Stove's http dsl)

http {
 webSocket("/chat") { actual -> 
   // we need to think more about the `actual` reference here,
   // what could possibly be the best object to interact and assert with 🤔 
   }
}
@bilal-kilic bilal-kilic self-assigned this Dec 12, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants