Skip to content

Commit a14ae8e

Browse files
author
Sergei Kravchuk
committedJul 11, 2019
[+] add push message client
1 parent 94b50ac commit a14ae8e

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed
 

‎README.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Demo Websocket Server (proof of concept)
2+
3+
14
Event (
25
type: SUBSCRIBE, UNSUBSCRIBE, MESSAGE
36
payload: Text

‎demo_ws_client/build.gradle.kts

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ dependencies {
2121
implementation("org.jetbrains.kotlin:kotlin-reflect")
2222
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
2323
implementation(project(":demo_ws_common"))
24+
implementation(project(":demo_ws_push_executor"))
2425
}
2526

2627
tasks.withType<KotlinCompile> {
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,21 @@
11
package net.alfss.demowsclient
22

3+
import net.alfss.demowspushexecutor.entrypoins.http.entities.HttpPushMessageEntity
4+
import org.springframework.http.MediaType
5+
import org.springframework.web.reactive.function.client.WebClient
6+
import java.sql.Timestamp
7+
8+
fun main(args: Array<String>) {
9+
val client = WebClient.builder().baseUrl("http://localhost:8001").build()
10+
11+
val message = HttpPushMessageEntity("tours/9d1cfe43-b917-4a22-8406-2494bedf3f72", Timestamp(System.currentTimeMillis()).toString())
12+
13+
val result = client.post()
14+
.uri("/notification/message")
15+
.contentType(MediaType.APPLICATION_JSON)
16+
.syncBody(message)
17+
.retrieve()
18+
.bodyToMono(Void::class.java).log().then()
19+
20+
result.block()
21+
}

0 commit comments

Comments
 (0)