{"id":9008,"date":"2020-07-15T13:13:06","date_gmt":"2020-07-15T17:13:06","guid":{"rendered":"https:\/\/irreal.org\/blog\/?p=9008"},"modified":"2020-07-15T13:56:20","modified_gmt":"2020-07-15T17:56:20","slug":"websockets-from-emacs","status":"publish","type":"post","link":"https:\/\/irreal.org\/blog\/?p=9008","title":{"rendered":"Websockets from Emacs"},"content":{"rendered":"<p><a href=\"https:\/\/en.wikipedia.org\/wiki\/WebSocket\">Websockets<\/a> are a way of providing two way communication between a Web server and a browser. Their benefit is that the server can send data asynchronously to the browser. That differs from the normal protocol of the browser sending a request and the server responding. With websockets, the server can send data whenever it needs to. A good example of their use is in the Web-based chat applications that many companies use for customer support.<\/p>\n<p>Naturally, Emacs has a way of interacting with Websockets. You can write code to act either as a client or server. Adrien Brochard has a very <a href=\"https:\/\/blog.abrochard.com\/websockets.html\">nice post<\/a> that illustrates the use of <a href=\"https:\/\/github.com\/ahyatt\/emacs-websocket\">emacs-websocket<\/a> package for using websockets.<\/p>\n<p>Brochard\u2019s post is sort of a minitutorial. He shows how to use the basic interface to send a message to the server and to write a server side function that refreshes a page on the browser whenever it\u2019s code on the server is updated. The interface is simple and easy to use. Brochard\u2019s examples include some code written in Javascript that talks to Elisp code using websockets.<\/p>\n<p>If you have any interest at all in websockets or working with them, be sure to take a look at Brochard\u2019s post. It\u2019s an excellent introduction and well worth the time to read.<\/p>\n<p><b>UPDATE<\/b> <span class=\"timestamp-wrapper\"><span class=\"timestamp\">[2020-07-15 Wed 13:53]<\/span><\/span>: Fixed link to Brochard\u2019s post.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Websockets are a way of providing two way communication between a Web server and a browser. Their benefit is that the server can send data asynchronously to the browser. That differs from the normal protocol of the browser sending a &hellip; <a href=\"https:\/\/irreal.org\/blog\/?p=9008\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[18],"class_list":["post-9008","post","type-post","status-publish","format-standard","hentry","category-general","tag-emacs"],"_links":{"self":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/9008","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=9008"}],"version-history":[{"count":3,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/9008\/revisions"}],"predecessor-version":[{"id":9011,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/9008\/revisions\/9011"}],"wp:attachment":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=9008"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=9008"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=9008"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}