Skip to content

Latest commit

 

History

History
49 lines (39 loc) · 1.17 KB

File metadata and controls

49 lines (39 loc) · 1.17 KB

Sky | Netty Based Transport Tool Kit.

🚀 Use sky you can quickly create an http service or websocket service

Features

  • Http Server
  • Websocket Server
  • Spring boot starter in development (已经基本可用)
  • 😙give me some issue!

Showcase

<dependency>
  <groupId>io.github.fzdwx</groupId>
  <artifactId>sky-http-springboot-starter</artifactId>
  <version>0.10.6</version>
</dependency>
import http.HttpServerRequest;

@SpringBootApplication
@RestController
public class BurstServerApplication {

    public static void main(String[] args) {
        final ConfigurableApplicationContext run = SpringApplication.run(BurstServerApplication.class);
    }

    // normal request
    @GetMapping("hello")
    public String hello(@RequestParam String name) {
        return "Hello " + name;
    }

    // upgrade to websocket
    @GetMapping("connect")
    public void connect(@RequestParam String name, HttpServerRequest request) {
        request.upgradeToWebSocket(ws->{
            ws.mountOpen(h -> {
                ws.send("Hello " + name);
            });
        });
    }
}