1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

x.websocket: move to net.websocket module (#10648)

This commit is contained in:
Tomas Hellström
2021-07-03 01:56:00 +02:00
committed by GitHub
parent c44a47acb1
commit ec973f5c6e
41 changed files with 1656 additions and 67 deletions

View File

@ -1,7 +1,7 @@
module main
import os
import x.websocket
import net.websocket
import term
// This client should be compiled an run in different konsoles

View File

@ -1,6 +1,6 @@
module main
import x.websocket
import net.websocket
import term
// this server accepts client connections and broadcast all messages to other connected clients

View File

@ -2,7 +2,7 @@ module main
import time
import os
import x.websocket
import net.websocket
fn main() {
println('press enter to quit...\n')
@ -12,6 +12,8 @@ fn main() {
os.get_line()
}
// start_server starts the websocket server, it receives messages
// and send it back to the client that sent it
fn start_server() ? {
mut s := websocket.new_server(.ip6, 30000, '')
// Make that in execution test time give time to execute at least one time
@ -36,6 +38,8 @@ fn start_server() ? {
}
}
// start_client starts the websocket client, it writes a message to
// the server and prints all the messages received
fn start_client() ? {
mut ws := websocket.new_client('ws://localhost:30000') ?
// mut ws := websocket.new_client('wss://echo.websocket.org:443')?