2015-10-16 74 views

回答

2

为JSON没有直接标注,但可以使用:

@ServerEndpoint(value = "/websocket", 
    encoders = { JsonEncoder.class }, 
    decoders = { JsonDecoder.class }) 

JsonEncoder,JsonDecoder是它实现Encoder.Text,Decoder.Text接口的类。你可以在这里找到样品:Java EE HTML5 WebSockets Encoder and Decoder example