gaojingsong 阅读(24) 评论(0)

This is a implementation of a websocket server and client for the spray.io web toolkit. It is currently a work in progress, but it has a pretty comprehensive test suite that exercises a whole bunch of functionality. The server/client can:



 Spray是基于Akka之上的轻量级Scala库,提供对客户端与服务端REST/HTTP的支持。在使用上,大概可以将其视为Java平台下的Jersey;虽然它们的特性并不尽相同。从scala语言来看,它提供的Future与Promise可以较好地支持并发;而Akka的Actor模型无疑助推了Spray的并发处理性能。根据Spray官方网站的描述,它拥有如下的特性:

完全异步的,无阻塞的APIs

基于Actor与Future

高性能

轻量级

模块化

可测试性

 

 

Work under SSL (all the tests are done both in the clear and under SSL)

Handle fragmented messages (the server will buffer up a complete message before passing it to your frameHandler

Cut off messages which are too big (whether single-messages or fragmented)

Kill the connection when there's a protocol violation according to the websocket spec (probably doesn't account for everything at the moment)

Automatically respond to pings with pongs

Match up outgoing Pings and incoming Pongs to find round trip times

Automatically ping every client according to the autoPingInterval, using the pingGenerator to generate the body of each ping

Pass almost the entire Autobahn Test Suite

client-report.html and sever-report.html contain the Autobahn test reports for both the server and the client. The only tests currently failing are unicode strictness tests, which means the server isn't killing connections in the case of malformed unicode as strictly as it should.