;; in the repl do the following to import the libs (use 'gifsockets.core) (use 'gifsockets.server) ;; ;;Then we declare the tcp server (def server (tcp-server :port 8081 :handler gif-handler)) (start2 server) ;; wait for a browser connection on port 8081 ;; go and open http://localhost:8081/ in Safari or IE6 ;; In Chrome it works a bit laggy and in Firefox it doesn't work at all ;; ;; Now let's create the gif encoder that we use to write messages to the browser. (def encoder (create-gif (.getOutputStream client))) ;; ;;Now we are ready to send messages to that browser client (add-message encoder "Hello gif-sockets") ;; now you should see a GIF image with the new message on it. (add-message encoder "Zup zup zup") (add-message encoder "And so forth") ;; ;; Now let's clean up and close the connection (.finish encoder) (.close client)
Source: https://habr.com/ru/post/151538/
All Articles