public class Reason extends Object
Reason
object is used to hold a textual reason
for connection closure and an RFC 6455 defined code. When a
connection is to be closed a control frame with an opcode of
close is sent with the text reason, if one is provided.Constructor and Description |
---|
Reason(CloseCode code)
Constructor for the
Reason object. |
Reason(CloseCode code,
String text)
Constructor for the
Reason object. |
Modifier and Type | Method and Description |
---|---|
CloseCode |
getCode()
This is used to get the RFC 6455 code describing the type
of close event.
|
String |
getText()
This is used to get the textual description for the closure.
|
String |
toString()
This is used to provide a textual representation of the reason.
|
public Reason(CloseCode code)
Reason
object. This is used
to create a reason and a textual description of that reason
to be delivered as a control frame.code
- this is the code to be sent with the framepublic Reason(CloseCode code, String text)
Reason
object. This is used
to create a reason and a textual description of that reason
to be delivered as a control frame.code
- this is the code to be sent with the frametext
- this is textual description of the close reasonpublic CloseCode getCode()
public String getText()
public String toString()
Copyright © 2023. All rights reserved.