language agnostic technologies introduced in pi web-agent 0.4rc2
TRANSCRIPT
![Page 1: Language agnostic technologies introduced in pi web-agent 0.4rc2](https://reader034.vdocuments.net/reader034/viewer/2022042723/58ed5fc01a28aba7708b458f/html5/thumbnails/1.jpg)
CSC Knowledge Summit 4/2015
Language Agnostic Technologies introduced in pi-web-agent 0.4rc2
Speaker:Andreas Galazis
![Page 2: Language agnostic technologies introduced in pi web-agent 0.4rc2](https://reader034.vdocuments.net/reader034/viewer/2022042723/58ed5fc01a28aba7708b458f/html5/thumbnails/2.jpg)
So are you going to talk about Message queues?Not exactly ...You'll see that the problem we are trying to solve is not directly related with the purpose of message queues.
![Page 3: Language agnostic technologies introduced in pi web-agent 0.4rc2](https://reader034.vdocuments.net/reader034/viewer/2022042723/58ed5fc01a28aba7708b458f/html5/thumbnails/3.jpg)
First couple of problems
We need low latency communication between the client and the server
We need full duplex communication between the server
![Page 4: Language agnostic technologies introduced in pi web-agent 0.4rc2](https://reader034.vdocuments.net/reader034/viewer/2022042723/58ed5fc01a28aba7708b458f/html5/thumbnails/4.jpg)
Previous solutionsRegular http requests:
![Page 5: Language agnostic technologies introduced in pi web-agent 0.4rc2](https://reader034.vdocuments.net/reader034/viewer/2022042723/58ed5fc01a28aba7708b458f/html5/thumbnails/5.jpg)
Previous solutionsAjax Polling
![Page 6: Language agnostic technologies introduced in pi web-agent 0.4rc2](https://reader034.vdocuments.net/reader034/viewer/2022042723/58ed5fc01a28aba7708b458f/html5/thumbnails/6.jpg)
Solution: Html5 WebSockets
![Page 7: Language agnostic technologies introduced in pi web-agent 0.4rc2](https://reader034.vdocuments.net/reader034/viewer/2022042723/58ed5fc01a28aba7708b458f/html5/thumbnails/7.jpg)
Problem solved?
NO!
![Page 8: Language agnostic technologies introduced in pi web-agent 0.4rc2](https://reader034.vdocuments.net/reader034/viewer/2022042723/58ed5fc01a28aba7708b458f/html5/thumbnails/8.jpg)
Pi Web Agent is A PlatformWhat’s the point of having a platform?(unified development process/attract different developers )I can build my own websocket server.There exist a variety of modules/libraries that can provide websocket support for each language. What about newcomers that have to figure out what they should use?
Try to build web socket server to serve your bash script.Try to plug websockets to an existing application on your linux machine.
![Page 9: Language agnostic technologies introduced in pi web-agent 0.4rc2](https://reader034.vdocuments.net/reader034/viewer/2022042723/58ed5fc01a28aba7708b458f/html5/thumbnails/9.jpg)
Problem not solved yet!
![Page 10: Language agnostic technologies introduced in pi web-agent 0.4rc2](https://reader034.vdocuments.net/reader034/viewer/2022042723/58ed5fc01a28aba7708b458f/html5/thumbnails/10.jpg)
Websocketd
It's like CGI, twenty years later, for WebSocketsA web socket daemon for unix machines
-Doug McIlroy inventor of the Unix pipe
“Write programs that do one thing and do it well.Write programs to work together.
Write programs to handle text streams,because that is a universal interface.”
![Page 11: Language agnostic technologies introduced in pi web-agent 0.4rc2](https://reader034.vdocuments.net/reader034/viewer/2022042723/58ed5fc01a28aba7708b458f/html5/thumbnails/11.jpg)
Websocketd
“Write programs that do one thing and do it well!”Websocketd really does one thing...
For every connection :Run one instance of your application with its stdin/stdout converted to bidirectional websocket communicationWhat if you want to broadcast your messages?
![Page 12: Language agnostic technologies introduced in pi web-agent 0.4rc2](https://reader034.vdocuments.net/reader034/viewer/2022042723/58ed5fc01a28aba7708b458f/html5/thumbnails/12.jpg)
Problem not solved yet!
![Page 13: Language agnostic technologies introduced in pi web-agent 0.4rc2](https://reader034.vdocuments.net/reader034/viewer/2022042723/58ed5fc01a28aba7708b458f/html5/thumbnails/13.jpg)
Publish/Subscribe message queue-fanout
In our case rabbitMQ was usedThe scenariocomponents:
● Producer: user application that sends messages.● Exchange: receives messages from producers
and it pushes them to queues● Queue: a buffer that stores messages.● Consumer: application that receives messages.
Bindings: the relationship between the exchange and the que
bb
![Page 14: Language agnostic technologies introduced in pi web-agent 0.4rc2](https://reader034.vdocuments.net/reader034/viewer/2022042723/58ed5fc01a28aba7708b458f/html5/thumbnails/14.jpg)
Putting it all together:WebsocketdBroSo do people need to care about using the two technologies together?WebsocketdBro( a websocketd broadcaster):
your app
Websocketdruns consumers
Browser Browser
![Page 15: Language agnostic technologies introduced in pi web-agent 0.4rc2](https://reader034.vdocuments.net/reader034/viewer/2022042723/58ed5fc01a28aba7708b458f/html5/thumbnails/15.jpg)
Questions?
![Page 16: Language agnostic technologies introduced in pi web-agent 0.4rc2](https://reader034.vdocuments.net/reader034/viewer/2022042723/58ed5fc01a28aba7708b458f/html5/thumbnails/16.jpg)
References● rabbitmq - Provides robust messaging for applications!● websocketd - WebSockets the UNIX way!● websocketdBro - Combines rabbitmq and websocketd to support message broadcasting