Class SockJsFrame
- java.lang.Object
- org.springframework.web.socket.sockjs.frame.SockJsFrame
public class SockJsFrame extends Object
Represents a SockJS frame. Provides factory methods to create SockJS frames.- Since:
- 4.0
- Author:
- Rossen Stoyanchev
Constructor Summary
Constructors Constructor Description SockJsFrame(String content)Create a new instance frame with the given frame content.
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SockJsFramecloseFrame(int code, String reason)static SockJsFramecloseFrameAnotherConnectionOpen()static SockJsFramecloseFrameGoAway()booleanequals(Object other)StringgetContent()Return the SockJS frame content (nevernull).byte[]getContentBytes()Return the SockJS frame content as a byte array.StringgetFrameData()Return data contained in a SockJS "message" and "close" frames.SockJsFrameTypegetType()Return the SockJS frame type.inthashCode()static SockJsFrameheartbeatFrame()static SockJsFramemessageFrame(SockJsMessageCodec codec, String... messages)static SockJsFrameopenFrame()StringtoString()
Constructor Detail
SockJsFrame
public SockJsFrame(String content)
Create a new instance frame with the given frame content.- Parameters:
content- the content (must be a non-empty and represent a valid SockJS frame)
Method Detail
getType
public SockJsFrameType getType()
Return the SockJS frame type.
getContent
public String getContent()
Return the SockJS frame content (nevernull).
getContentBytes
public byte[] getContentBytes()
Return the SockJS frame content as a byte array.
getFrameData
public String getFrameData()
Return data contained in a SockJS "message" and "close" frames. Otherwise for SockJS "open" and "close" frames, which do not contain data, returnnull.
openFrame
public static SockJsFrame openFrame()
heartbeatFrame
public static SockJsFrame heartbeatFrame()
messageFrame
public static SockJsFrame messageFrame(SockJsMessageCodec codec, String... messages)
closeFrameGoAway
public static SockJsFrame closeFrameGoAway()
closeFrameAnotherConnectionOpen
public static SockJsFrame closeFrameAnotherConnectionOpen()
closeFrame
public static SockJsFrame closeFrame(int code, String reason)