<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>socket.io | Nerdpress.org</title>
	<atom:link href="https://nerdpress.org/category/js/socket-io/feed/" rel="self" type="application/rss+xml" />
	<link>https://nerdpress.org</link>
	<description>...dev, tech problems and solutions.</description>
	<lastBuildDate>Sun, 03 Feb 2013 10:04:27 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>mashcloud.net &#8211; mashup soundcloud audio tracks</title>
		<link>https://nerdpress.org/2013/01/24/mashcloud-net-mashup-soundcloud-audio-tracks/</link>
		
		<dc:creator><![CDATA[Max Girkens]]></dc:creator>
		<pubDate>Thu, 24 Jan 2013 20:08:28 +0000</pubDate>
				<category><![CDATA[API]]></category>
		<category><![CDATA[Express]]></category>
		<category><![CDATA[Frontend]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[JS]]></category>
		<category><![CDATA[node.js]]></category>
		<category><![CDATA[socket.io]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[sockets]]></category>
		<category><![CDATA[soundcloud]]></category>
		<guid isPermaLink="false">https://nerdpress.org/?p=2359</guid>

					<description><![CDATA[<p>mashcloud.net is an experiment on collaborative realtime audio editing and music creation. I did the project within the frame of  my BA thesis in audio production last year. As I moved the code to github this week, I wanted to give a quick overview of the project and its technical underlyings, just in case someone might &#8230; </p>
<p class="link-more"><a href="https://nerdpress.org/2013/01/24/mashcloud-net-mashup-soundcloud-audio-tracks/" class="more-link">Continue reading<span class="screen-reader-text"> "mashcloud.net &#8211; mashup soundcloud audio tracks"</span></a></p>
The post <a href="https://nerdpress.org/2013/01/24/mashcloud-net-mashup-soundcloud-audio-tracks/">mashcloud.net – mashup soundcloud audio tracks</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></description>
										<content:encoded><![CDATA[<p><a href="http://mashcloud.net/">mashcloud.net</a> is an experiment on collaborative realtime audio editing and music creation. <br />I did the project within the frame of  my BA thesis in audio production last year.</p>
<p>As I moved the code to <a href="https://github.com/gherkins/mashcloud">github</a> this week, I wanted to give a quick overview of the project and its technical underlyings, just in case someone might be interested :)</p>
<p><span id="more-2359"></span>As the title of this post might already suggest, its about selecting and layering loops from audiofiles hosted on <a href="http://soundcloud.com">soundcloud.com</a> and thereby creating new music.</p>
<p><a href="https://nerdpress.org/2013/01/24/mashcloud-net-mashup-soundcloud-audio-tracks/bildschirmfoto-2013-01-24-um-20-46-08/" rel="attachment wp-att-2363"><img fetchpriority="high" decoding="async" class="alignnone size-medium wp-image-2363" alt="Bildschirmfoto 2013-01-24 um 20.46.08" src="https://nerdpress.org/wp-content/uploads/2013/01/Bildschirmfoto-2013-01-24-um-20.46.08-300x174.png" width="300" height="174" srcset="https://nerdpress.org/wp-content/uploads/2013/01/Bildschirmfoto-2013-01-24-um-20.46.08-300x174.png 300w, https://nerdpress.org/wp-content/uploads/2013/01/Bildschirmfoto-2013-01-24-um-20.46.08-1024x593.png 1024w, https://nerdpress.org/wp-content/uploads/2013/01/Bildschirmfoto-2013-01-24-um-20.46.08.png 1050w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>Those collections of layered loops are called a session. Sessions can be created anonymously by everyone and are auto-saved on every action. By distributing the URL of a session other users can join and every action is synced between all users in realtime. <br />(complete mayhem, indeed :)</p>
<p>The application is built with HTML5 and JS w/ <a href="http://jquery.com/">jQuery</a> using the <a href="http://developers.soundcloud.com/docs/api/guide">soundcloud API</a> on the client side and runs on <a href="http://nodejs.org/">node.js</a> &amp; <a href="http://www.mongodb.org/">mongoDB</a> with <a href="http://expressjs.com/">express</a>, <a href="http://socket.io/">socket.io</a> and <a href="http://mongoosejs.com/">mongoose</a> on the server side.</p>
<p>I basically started the project to find out if you could play multiple loops asynchronous and synced with low latency using the <a href="https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html">Web Audio API</a> while collaboratively working together with multiple users in realtime. </p>
<p>As that turned out to be not only possible but performed real nicely, the experiment then developed in somewhat of an application and finally got a name and a face.</p>
<p>There&#8217;s a whole lot of things i&#8217;d like to implement / refactor and do when i get some time on my hands, as</p>
<p>&#8211; adding a &#8220;record&#8221; feature to record, save and export created sessions as audiofiles</p>
<p>&#8211; rewriting the client side with <a href="http://backbonejs.org/">backbone.js</a> (as things got a bit messy &#8230;)</p>
<p>&#8211; adding some audio effects to the tracks</p>
<p>&#8211; write some tests</p>
<p>I&#8217;d appreciate any form of contribution as much as any questions or feedback on the project :)</p>
<p>Feel free to check out the live version at <a href="http://mashcloud.net/"> http://mashcloud.net/</a> or the sources at <a href="https://github.com/gherkins/mashcloud">https://github.com/gherkins/mashcloud</a></p>The post <a href="https://nerdpress.org/2013/01/24/mashcloud-net-mashup-soundcloud-audio-tracks/">mashcloud.net – mashup soundcloud audio tracks</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Hosting multiple Express (node.js) apps on port 80</title>
		<link>https://nerdpress.org/2012/04/20/hosting-multiple-express-node-js-apps-on-port-80/</link>
					<comments>https://nerdpress.org/2012/04/20/hosting-multiple-express-node-js-apps-on-port-80/#comments</comments>
		
		<dc:creator><![CDATA[Max Girkens]]></dc:creator>
		<pubDate>Fri, 20 Apr 2012 03:40:31 +0000</pubDate>
				<category><![CDATA[Admin]]></category>
		<category><![CDATA[Express]]></category>
		<category><![CDATA[node.js]]></category>
		<category><![CDATA[socket.io]]></category>
		<category><![CDATA[vServer]]></category>
		<category><![CDATA[express]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[proxy]]></category>
		<category><![CDATA[sockets]]></category>
		<guid isPermaLink="false">https://nerdpress.org/?p=2144</guid>

					<description><![CDATA[<p>In the last days, i was trying to find a solution hosting multiple Express apps on my vServer the same Server. Starting with Apache and mod_proxy, i ended up with a plain node solution, which i really like. Let&#8217;s take a quick look on some different approaches out there: &#8212;1&#8212; Using apache on port 80 &#8230; </p>
<p class="link-more"><a href="https://nerdpress.org/2012/04/20/hosting-multiple-express-node-js-apps-on-port-80/" class="more-link">Continue reading<span class="screen-reader-text"> "Hosting multiple Express (node.js) apps on port 80"</span></a></p>
The post <a href="https://nerdpress.org/2012/04/20/hosting-multiple-express-node-js-apps-on-port-80/">Hosting multiple Express (node.js) apps on port 80</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></description>
										<content:encoded><![CDATA[<p>In the last days, i was trying to find a solution hosting multiple <a href="http://expressjs.com/">Express</a> apps on <del datetime="2012-04-19T00:40:35+00:00">my vServer </del>the same Server.</p>
<p>Starting with <a href="http://www.apache.org/">Apache</a> and <a href="http://httpd.apache.org/docs/2.0/mod/mod_proxy.html">mod_proxy</a>, i ended up with a plain node solution, which i really like.<span id="more-2144"></span></p>
<p><a href="https://nerdpress.org/wp-content/uploads/2012/04/node-http-proxy-haz-colors.png"><img decoding="async" class="alignnone size-full wp-image-2146" title="node-http-proxy-haz-colors" src="https://nerdpress.org/wp-content/uploads/2012/04/node-http-proxy-haz-colors.png" alt="" width="527" height="106" srcset="https://nerdpress.org/wp-content/uploads/2012/04/node-http-proxy-haz-colors.png 527w, https://nerdpress.org/wp-content/uploads/2012/04/node-http-proxy-haz-colors-300x60.png 300w" sizes="(max-width: 527px) 100vw, 527px" /></a></p>
<p>Let&#8217;s take a quick look on some different approaches out there:</p>
<p><strong>&#8212;1&#8212;</strong></p>
<p>Using apache on port 80 as a proxy</p>
<pre class="brush: bash; title: ; notranslate">
ProxyPass /nodeurls/ http://localhost:9000/
ProxyPassReverse /nodeurls/ http://localhost:9000/
</pre>
<p>via <a href="http://stackoverflow.com/questions/6109089/how-do-i-run-node-js-on-port-80">stackoverflow</a></p>
<p>&#8212; no websockets<br />
++ probably the easiest way to integrate with your running AMPP-stack</p>
<p><strong>&#8212;2&#8212;</strong></p>
<p>Using a node.js app on port 80 as a Wrapper for other node apps.</p>
<pre class="brush: jscript; title: ; notranslate">
express.createServer()
  .use(express.vhost('hostname1.com', require('/path/to/hostname1').app)
  .use(express.vhost('hostname2.com', require('/path/to/hostname2').app)
.listen(80)
</pre>
<p>via <a href="http://stackoverflow.com/questions/9332865/how-should-i-organize-multiple-express-servers-on-the-same-system">stackoverflow</a></p>
<p>++ you can use websockets on port 80<br />
&#8212; apps crash/restart/stop globally<br />
&#8211;what about your apache or the like?</p>
<p><strong>&#8212;3&#8212;</strong></p>
<p>Using node.js with node-http-proxy on port 80</p>
<pre class="brush: jscript; title: ; notranslate">
var http = require('http')
, httpProxy = require('http-proxy');

httpProxy.createServer({
  hostnameOnly: true,
  router: {
    //web-development.cc
    'www.my-domain.com': '127.0.0.1:3001',
    'www.my-other-domain.de' : '127.0.0.1:3002'
  }
}).listen(80);

</pre>
<p>++ proxy websockets to any port<br />
&#8212; you might need to move your old web server to another port</p>
<p>The really cool thing about using node-http-proxy is its capability of proxying websockets.<br />
So you can have your apps running independtly on different ports while serving everything to the user over port 80 and use stuff like <a href="http://socket.io/">socket.io</a>.</p>
<p>Since i&#8217;m new to node.js and miles away from beeing a admin, any feedback is highly appreciated :)</p>The post <a href="https://nerdpress.org/2012/04/20/hosting-multiple-express-node-js-apps-on-port-80/">Hosting multiple Express (node.js) apps on port 80</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></content:encoded>
					
					<wfw:commentRss>https://nerdpress.org/2012/04/20/hosting-multiple-express-node-js-apps-on-port-80/feed/</wfw:commentRss>
			<slash:comments>14</slash:comments>
		
		
			</item>
		<item>
		<title>Sending invalid Unicode via socket.io</title>
		<link>https://nerdpress.org/2011/11/16/sending-invalid-unicode-via-socket-io/</link>
		
		<dc:creator><![CDATA[Ivo Bathke]]></dc:creator>
		<pubDate>Wed, 16 Nov 2011 14:48:54 +0000</pubDate>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[socket.io]]></category>
		<guid isPermaLink="false">https://nerdpress.org/?p=1971</guid>

					<description><![CDATA[<p>Well you can try to, but it will end up almost probably in an disconnect which is caused by the browser. As i have learned here. Given you have a string which contains invalid unicode like: This will trouble the browser and the socket connection. If you prepare your json with PHP and  json_encode the &#8230; </p>
<p class="link-more"><a href="https://nerdpress.org/2011/11/16/sending-invalid-unicode-via-socket-io/" class="more-link">Continue reading<span class="screen-reader-text"> "Sending invalid Unicode via socket.io"</span></a></p>
The post <a href="https://nerdpress.org/2011/11/16/sending-invalid-unicode-via-socket-io/">Sending invalid Unicode via socket.io</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></description>
										<content:encoded><![CDATA[<p>Well you can try to, but it will end up almost probably in an disconnect which is caused by the browser.<br />
As i have learned <a href="https://github.com/LearnBoost/socket.io/issues/572">here</a>.</p>
<p>Given you have a string which contains invalid unicode like:</p>
<p><a href="https://nerdpress.org/wp-content/uploads/2011/11/invalid_unicode.png"><img decoding="async" class="alignnone size-medium wp-image-1976" title="invalid_unicode" src="https://nerdpress.org/wp-content/uploads/2011/11/invalid_unicode-300x29.png" alt="" width="300" height="29" srcset="https://nerdpress.org/wp-content/uploads/2011/11/invalid_unicode-300x29.png 300w, https://nerdpress.org/wp-content/uploads/2011/11/invalid_unicode.png 334w" sizes="(max-width: 300px) 100vw, 300px" /></a><br />
This will trouble the browser and the socket connection.</p>
<p>If you prepare your json with PHP and  <em>json_encode</em> the Unicode will be escaped to some strings like these:</p>
<p><code>\ud83d\ude31\ud83d\ude31\ud83d\ude04\ud83d\ude04\ud83d\udc9c\ud83d\udc9c\ud83d\udc4a</code></p>
<p>But on clientside it will still result in invalid Unicode.<br />
<span id="more-1971"></span></p>
<p>So after a lot of recherche i found <a href="http://stackoverflow.com/questions/410704/cyrillic-characters-in-phps-json-encode">this</a> and used the <em>decodeUnicodeString</em> function from Zend to convert the escaped Unicode characters again to their unescaped representation. (dont forget the replacement as described in the post at stackoverflow if you extract it from Zend)<br />
If the character is invalid it will be replaced by a question mark &#8216;?&#8217;.<br />
This is at least what i asume.<br />
The ? went through fine and the socket connection stays alive.</p>
<p>Ok the downside is you loose weird signs for an &#8216;?&#8217;, but i can live with that.<br />
But im not really convinced with that solution, so if anybody knows another way to detect invalid Unicode sequences, let me know!</p>The post <a href="https://nerdpress.org/2011/11/16/sending-invalid-unicode-via-socket-io/">Sending invalid Unicode via socket.io</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
