author | Alan Dipert
<alan@dipert.org> 2020-05-16 05:17:27 UTC |
committer | Alan Dipert
<alan@dipert.org> 2020-05-16 05:17:27 UTC |
parent | 26f66ac3f589fd6a6bcbd8391b693961f073ba3a |
jacl-client/.gitignore | +1 | -0 |
jacl-client/pom.xml | +34 | -0 |
jacl-client/src/main/abcl/client.lisp | +35 | -0 |
diff --git a/jacl-client/.gitignore b/jacl-client/.gitignore new file mode 100644 index 0000000..c8b241f --- /dev/null +++ b/jacl-client/.gitignore @@ -0,0 +1 @@ +target/* \ No newline at end of file diff --git a/jacl-client/pom.xml b/jacl-client/pom.xml new file mode 100644 index 0000000..a463e85 --- /dev/null +++ b/jacl-client/pom.xml @@ -0,0 +1,34 @@ +<project> + <modelVersion>4.0.0</modelVersion> + <groupId>org.dipert</groupId> + <artifactId>jacl-client</artifactId> + <version>1.0.0</version> + + <properties> + <abcl.version>1.6.1</abcl.version> + </properties> + + <dependencies> + <dependency> + <groupId>org.abcl</groupId> + <artifactId>abcl</artifactId> + <version>${abcl.version}</version> + </dependency> + <dependency> + <groupId>org.abcl</groupId> + <artifactId>abcl-contrib</artifactId> + <version>${abcl.version}</version> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.dipert</groupId> + <artifactId>abcl-maven-plugin</artifactId> + <version>1.0.0-SNAPSHOT</version> + <extensions>true</extensions> + </plugin> + </plugins> + </build> +</project> diff --git a/jacl-client/src/main/abcl/client.lisp b/jacl-client/src/main/abcl/client.lisp new file mode 100644 index 0000000..3691819 --- /dev/null +++ b/jacl-client/src/main/abcl/client.lisp @@ -0,0 +1,35 @@ +(require :abcl-contrib) +(require :jss) + +(defun make-listener () + (jinterface-implementation + "java.net.http.WebSocket$Listener" + "onBinary" + (lambda (ws data last) + (error "onBinary: Unimplemented")) + "onClose" + (lambda (ws code reason) + (error "onClose: Unimplemented")) + "onError" + (lambda (ws err) + (error "onError: Unimplemented")) + "onOpen" + (lambda (ws) + (error "onOpen: Unimplemented")) + "onPing" + (lambda (ws msg) + (error "onPing: Unimplemented")) + "onPong" + (lambda (ws msg) + (error "onPong: Unimplemented")) + "onText" + (lambda (ws data last) + (error "onText: Unimplemented")))) + +(defun make-websocket (url) + (let* ((http-client (#"newHttpClient" 'java.net.http.HttpClient)) + (ws-builder (#"newWebSocketBuilder" http-client)) + (uri (#"create" 'java.net.URI url)) + (listener (make-listener))) + (#"buildAsync" ws-builder uri listener))) +