diff --git a/examples/nanocoap_server/Makefile b/examples/nanocoap_server/Makefile index 62c9f008e332..577a0f10c1d6 100644 --- a/examples/nanocoap_server/Makefile +++ b/examples/nanocoap_server/Makefile @@ -70,6 +70,7 @@ ifneq (,$(filter $(BOARD),$(HIGH_MEMORY_BOARDS))) endif USEMODULE += nanocoap_server_ws + USEMODULE += nanocoap_ws_udp_yolo # async TCP is not supported on GNRC yet ifeq ($(NETWORK_STACK),lwip) diff --git a/examples/nanocoap_server/main.c b/examples/nanocoap_server/main.c index 3a7ffc77ff36..f477b885f072 100644 --- a/examples/nanocoap_server/main.c +++ b/examples/nanocoap_server/main.c @@ -35,6 +35,10 @@ static msg_t _main_msg_queue[MAIN_QUEUE_SIZE]; static nanocoap_tcp_server_ctx_t tcp_ctx; #endif +#if MODULE_NANOCOAP_SERVER_WS && MODULE_NANOCOAP_WS_UDP_YOLO +static coap_ws_over_udp_yolo_init_arg_t _ws_ctx; +#endif + int main(void) { puts("RIOT nanocoap example application"); @@ -52,12 +56,20 @@ int main(void) #if MODULE_NANOCOAP_SERVER_TCP nanocoap_server_tcp(&tcp_ctx, EVENT_PRIO_MEDIUM, NULL); + printf("CoAP+TCP on PORT %u\n", (unsigned)tcp_ctx.local.port); +#endif + +#if MODULE_NANOCOAP_SERVER_WS && MODULE_NANOCOAP_WS_UDP_YOLO + sock_udp_ep_t local_ws = { .port = 1337, .family = AF_INET6 }; + nanocoap_server_ws(&coap_ws_over_udp_yolo, &_ws_ctx, &local_ws, sizeof(local_ws)); + printf("CoAP+YOLO on PORT %u\n", (unsigned)local_ws.port); #endif #if MODULE_NANOCOAP_UDP /* initialize nanocoap server instance */ uint8_t buf[COAP_INBUF_SIZE]; sock_udp_ep_t local = { .port=COAP_PORT, .family=AF_INET6 }; + printf("CoAP (UDP) on PORT %u\n", (unsigned)local.port); nanocoap_server_udp(&local, buf, sizeof(buf)); #endif