🚀 Use sky you can quickly create an http service or websocket service
- Http Server
- Websocket Server
- Spring boot starter in development (已经基本可用)
- 😙give me some issue!
<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);
});
});
}
}