Revision eab111d2

View differences:

Public/assets/psng.js
66 66
	if (channel.length > 0)
67 67
	{
68 68
		var xhttp = new XMLHttpRequest();
69
		xhttp.onreadystatechange = function() {
70
			if (this.readyState == 4 && this.status == 200) {
71
				alert("Refreshed!");
72
			}
73
		};
74 69
		xhttp.open("UPDATE", "/channels/" + channel, true);
75 70
		xhttp.send();
76 71
	}
src/path_handlers.c
112 112

  
113 113
void streamer_update(struct mg_connection *nc, struct http_message *hm)
114 114
{
115
	char * id;
115
	char * id, * json;
116 116
	const struct pstreamer * ps;
117 117
	const struct context * c;
118 118

  
......
125 125
	{
126 126
		pstreamer_touch((struct pstreamer*) ps);
127 127
		debug("\tInstance %s found and touched\n", id);
128
	} else
128
		json = pstreamer_to_json(ps);
129
		mg_printf(nc, "%s", "HTTP/1.1 200 OK\r\nTransfer-Encoding: chunked\r\n\r\n");
130
		mg_printf_http_chunk(nc, "%s", json);
131
		mg_send_http_chunk(nc, "", 0); /* Send empty chunk, the end of response */
132
		free(json);
133
	} else {
129 134
		debug("\tInstance %s not found\n", id);
135
		mg_printf(nc, "%s", "HTTP/1.1 404 Not Found\r\nTransfer-Encoding: chunked\r\n\r\n");
136
		mg_send_http_chunk(nc, "", 0); /* Send empty chunk, the end of response */
137
	}
130 138

  
131 139
	free(id);
132 140
}

Also available in: Unified diff