- Type Parameters:
INPUT- This reqpresents the type that the Asynchronous Communications I/O is expecting to send. This class was originally developled to be used with
WebSockets, and in that case,
'INPUT'type would be of type
NOTE: The contents of that
Stringare in JSON format.
- All Known Implementing Classes:
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface Sender<INPUT>This functional-interface should have the code/logic for sending an
'INPUT'message or request to the asynchronous I/O system/channel.
The three classes,
Senderare designed to allow for the creation of 'Asynchronous Scripts' that may be executed and made to appear to be synchronous through the
These three classes are made use of in the Browser Remote Debugging Protocol Package. Theoretically, they could be used by any asynchronous communication system.
- View Here: Torello/Java/Additional/Sender.java
- Open New Browser-Tab: Torello/Java/Additional/Sender.java
sendThis needs to contain the logic for sending a message with an id over the asynchronous I/O channel.
NOTE: So far, the use of the classes
Senderhas solely been for the Browser Remote Debug Protocol. For that use, the instance of
Senderused is the
'send'method will simply transmit a Json
java.lang.Stringto over a
ALSO: See that the
'promise'that is ultimately returned to the user needs to be passed as a parameter here.
requestID- The ID of the request-message. This ID allows the asynchronous logic to match responses to requests, since they are received asynchronously.
requestMessage- The message to be sent. For the Browser RPD System, this message will always be a JSON
promise- The promise that's going to be returned to the user.
NOTE: It may be obvious that the instance of
Promisehere is a
Raw-Typeinstance of a generic class. The reason that the
Promiseis instantiated inside the
Script.exec()method is precisely because the generic types are not used here.
Because the class
Promise, and immediately returns it to the user, the generic-type parameters are much easier to ignore. Note that, currently, the only implementing class of
WebSocketSender. This classes has
Raw-Typesat the top of the page.