pub enum MessagePortRequest {
PostMessage {
message: WebMessage,
responder: MessagePortPostMessageResponder,
},
ReceiveMessage {
responder: MessagePortReceiveMessageResponder,
},
}
Expand description
Represents one end of an HTML5 MessageChannel. Can be used to send and exchange Messages with the peered MessagePort in the Frame’s script context. The port is destroyed when either end of the MessagePort channel is torn down.
Variants§
PostMessage
Sends a WebMessage
to the peer. These are processed in order, one at a
time. It is not necessary for the caller to wait for the completion callback before calling
[MessagePort.PostMessage
] again.
If an error occurred, the FrameError
will be set to one of these value:
BUFFER_NOT_UTF8
: The script inmessage
’sdata
property is not UTF-8 encoded.NO_DATA_IN_MESSAGE
: Thedata
property is missing inmessage
.
ReceiveMessage
Asynchronously reads the next message from the channel. The client should invoke the callback when it is ready to process another message. Unreceived messages are buffered on the sender’s side and bounded by its available resources.
Fields
responder: MessagePortReceiveMessageResponder
Implementations§
Source§impl MessagePortRequest
impl MessagePortRequest
pub fn into_post_message( self, ) -> Option<(WebMessage, MessagePortPostMessageResponder)>
pub fn into_receive_message(self) -> Option<MessagePortReceiveMessageResponder>
Sourcepub fn method_name(&self) -> &'static str
pub fn method_name(&self) -> &'static str
Name of the method defined in FIDL