From 4f7481e2d0a4dc5cf3621ce31307a0ed13b739d7 Mon Sep 17 00:00:00 2001 From: jack Date: Mon, 17 Oct 2016 12:24:41 -0400 Subject: [PATCH] Grammar fixes, server_sent_events.md (#1255) Reworded a few sentences for clarity, fixed some grammar, added a link to httpie, and put more detail into some of the running instructions. --- source/developers/server_sent_events.markdown | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source/developers/server_sent_events.markdown b/source/developers/server_sent_events.markdown index 76716100ed6..502642e2edc 100644 --- a/source/developers/server_sent_events.markdown +++ b/source/developers/server_sent_events.markdown @@ -22,7 +22,7 @@ $ curl -X GET -H "x-ha-access: YOUR_PASSWORD" \ -H "Content-Type: application/json" http://localhost:8123/api/stream ``` -For more comfort put the HTML snippet below in a file `sse.html` in your `www` folder of your Home Assistant configuration directory (`.homeassistant`) +You can create a convenient view for this by creating an HTML file (`sse.html`) in the `www` folder of your Home Assistant configuration directory (`.homeassistant`). Paste this snippet into the file: ```html @@ -44,7 +44,7 @@ Visit [http://localhost:8123/local/sse.html](http://localhost:8123/local/sse.htm ## {% linkable_title Examples %} -A simplest way to consume server-sent events is `httpie`. +A simple way to consume server-sent events is to use a command-line http client like [httpie][https://httpie.org/]. Installation info is on the site (if you use Homebrew, it's `brew install httpie`). Once installed, run this snippet from your terminal: ```bash $ http --stream http://localhost:8123/api/stream x-ha-access:YOUR_PASSWORD content-type:application/json @@ -52,17 +52,17 @@ $ http --stream http://localhost:8123/api/stream x-ha-access:YOUR_PASSWORD conte ### {% linkable_title Website %} -The [home-assistant-sse](https://github.com/fabaff/home-assistant-sse) repository contains an more advanced example. +The [home-assistant-sse](https://github.com/fabaff/home-assistant-sse) repository contains a more advanced example. ### {% linkable_title Python %} -If you want test the server-sent events without creating a website then the Python module [`sseclient` ](https://pypi.python.org/pypi/sseclient/) can help. Install it first: +If you want to test the server-sent events without creating a website, the Python module [`sseclient` ](https://pypi.python.org/pypi/sseclient/) can help. To install (assuming Python and pip3 are already installed): ```bash $ pip3 install sseclient ``` -The simplest script to consume the SSE looks like the following snipplet. +The simplest script to consume the SSE in Python looks like this: ```python from sseclient import SSEClient