Class TeaNetwork
java.lang.Object
nl.colorize.multimedialib.renderer.teavm.TeaNetwork
- All Implemented Interfaces:
Network
Sends HTTP requests by delegating them to JavaScript and sending them as
AJAX requests. This does mean that any requests sent from the application
must be allowed by the CORS (Cross Origin Resource Sharing) headers
returned by the server.
Peer-to-peer connections are supported using WebRTC. This is mostly implemented in JavaScript using the PeerJS library.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionnl.colorize.util.Subject<nl.colorize.util.http.URLResponse> Sends a HTTP GET request to the specified URL.booleanReturns true if this renderer supports peer-to-peer connections on the current platform.Opens a peer-to-peer connection.nl.colorize.util.Subject<nl.colorize.util.http.URLResponse> Sends a HTTP POST request to the specified URL.
-
Constructor Details
-
TeaNetwork
public TeaNetwork()
-
-
Method Details
-
get
public nl.colorize.util.Subject<nl.colorize.util.http.URLResponse> get(String url, nl.colorize.util.http.Headers headers) Description copied from interface:NetworkSends a HTTP GET request to the specified URL. The request will be performed asyncrhonously, the returnedSubjectcan be used to subscribe to the response. -
post
public nl.colorize.util.Subject<nl.colorize.util.http.URLResponse> post(String url, nl.colorize.util.http.Headers headers, nl.colorize.util.http.PostData data) Description copied from interface:NetworkSends a HTTP POST request to the specified URL. The request will be performed asyncrhonously, the returnedSubjectcan be used to subscribe to the response. -
openPeerConnection
Description copied from interface:NetworkOpens a peer-to-peer connection. The protocol used for the connection depends on both the renderer and the current platform.- Specified by:
openPeerConnectionin interfaceNetwork
-
isPeerToPeerSupported
public boolean isPeerToPeerSupported()Description copied from interface:NetworkReturns true if this renderer supports peer-to-peer connections on the current platform. If this method returns false, trying to open peer-to-peer connections usingNetwork.openPeerConnection()will result in an exception.- Specified by:
isPeerToPeerSupportedin interfaceNetwork
-