<?xml version="1.0" encoding="ISO-8859-1"?>

<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		<title>La Comunidad DragonJAR - .Net</title>
		<link>http://comunidad.dragonjar.org/</link>
		<description />
		<language>es</language>
		<lastBuildDate>Fri, 24 May 2013 16:48:54 GMT</lastBuildDate>
		<generator>vBulletin</generator>
		<ttl>60</ttl>
		<image>
			<url>http://comunidad.dragonjar.org/images/misc/rss.png</url>
			<title>La Comunidad DragonJAR - .Net</title>
			<link>http://comunidad.dragonjar.org/</link>
		</image>
		<item>
			<title>SignalR en Asp.Net</title>
			<link>http://comunidad.dragonjar.org/f175/signalr-en-asp-net-14629/</link>
			<pubDate>Tue, 30 Apr 2013 14:50:43 GMT</pubDate>
			<description>SignalR es una libreria para Asp.Net que simplifica los procesos para adiconar funcionalidades en tiempo real a nuestras aplicaciones.  Imaginemos el...</description>
			<content:encoded><![CDATA[<div><!-- google_ad_section_start -->SignalR es una libreria para Asp.Net que simplifica los procesos para adiconar funcionalidades en tiempo real a nuestras aplicaciones.  Imaginemos el caso simple de un chat el cual envia mensajes en tiempo real entre varios usuarios. para este tipo de aplicacion se puede implementar Signalr; Con esta libreria puedes implementar .Net Framework como servidor de BakEnd  y Javascript entre como servidor de FontEnd.<br />
Para implementar un simple proyecto con SignalR se realizan los siguientes pasos:<br />
<br />
<b>1) Con la consola de de administracion de paquetes primero instalamos todos los paquetes necesarios de SignalR</b><br />
<div class="bbcode_container">
	<div class="bbcode_description">Código:</div>
	<hr /><code class="bbcode_code">Install-Package Microsoft.AspNet.SignalR</code><hr />
</div><b>2) Una vez realizada la instalacion de los paquetes de Signal Creamos nuestra clase que hereda de Hub.</b><br />
<div class="bbcode_container">
	<div class="bbcode_description">Código:</div>
	<hr /><code class="bbcode_code">&nbsp; public class Chat : Hub<br />
&nbsp; {<br />
&nbsp; &nbsp; &nbsp;  public void Send(string message)<br />
&nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Call the addMessage method on all clients<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Clients.All.addMessage(message);<br />
&nbsp; &nbsp; &nbsp; }<br />
&nbsp; }</code><hr />
</div><b>3) Despues se configura la tabla de ruta en el archivo Global.asax</b><br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Código:</div>
	<hr /><code class="bbcode_code">using System;<br />
using System.Web.Routing;<br />
<br />
namespace SampleWebApplication<br />
{<br />
&nbsp; &nbsp; public class Global : System.Web.HttpApplication<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; protected void Application_Start(object sender, EventArgs e)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; RouteTable.Routes.MapHubs();<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; }<br />
}</code><hr />
</div><b>4) Ahora la configuracion por parte del cliente, adicion del codigo Javascript y Html</b><br />
<div class="bbcode_container">
	<div class="bbcode_description">Código HTML:</div>
	<hr /><code class="bbcode_code"><span style="color:#800000">&lt;script type=<span style="color:#0000FF">&quot;text/javascript&quot;</span> src=<span style="color:#0000FF">&quot;http://code.jquery.com/jquery-1.8.2.min.<acronym title="JavaScript">js</acronym>&quot;</span>&gt;</span><span style="color:#800000">&lt;/script&gt;</span><br />
<span style="color:#800000">&lt;script type=<span style="color:#0000FF">&quot;text/javascript&quot;</span> src=<span style="color:#0000FF">&quot;Scripts/jquery.signalR-1.0.1.min.<acronym title="JavaScript">js</acronym>&quot;</span>&gt;</span><span style="color:#800000">&lt;/script&gt;</span><br />
<i><span style="color:#000080">&lt;!--&nbsp; If this is an MVC project then use the following --&gt;</span></i><br />
<i><span style="color:#000080">&lt;!--&nbsp; &lt;script src=<span style="color:#0000FF">&quot;~/signalr/hubs&quot;</span> type=<span style="color:#0000FF">&quot;text/javascript&quot;</span>&gt;</span><span style="color:#800000">&lt;/script&gt;</span> --&gt;</i><br />
<span style="color:#800000">&lt;script type=<span style="color:#0000FF">&quot;text/javascript&quot;</span> src=<span style="color:#0000FF">&quot;signalr/hubs&quot;</span>&gt;</span><span style="color:#800000">&lt;/script&gt;</span><br />
<span style="color:#800000">&lt;script type=<span style="color:#0000FF">&quot;text/javascript&quot;</span>&gt;</span>// <span style="color:#000080">&lt;!&#91;CDATA&#91;<br />
&nbsp; &nbsp; $(function () {<br />
&nbsp; &nbsp; &nbsp; &nbsp; // Proxy created on the fly<br />
&nbsp; &nbsp; &nbsp; &nbsp; var chat = $.connection.chat;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; // Declare a function on the chat hub so the server can invoke it<br />
&nbsp; &nbsp; &nbsp; &nbsp; chat.client.addMessage = function (message) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $('#messages').append('&lt;li&gt;' + message + '&lt;/li&gt;');<br />
&nbsp; &nbsp; &nbsp; &nbsp; };<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; // Start the connection<br />
&nbsp; &nbsp; &nbsp; &nbsp; $.connection.hub.start().done(function() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $(&quot;#broadcast&quot;).click(function () {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Call the chat method on the server<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; chat.server.send($('#msg').val());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; });<br />
&nbsp; &nbsp; &nbsp; &nbsp; });<br />
&nbsp; &nbsp; });<br />
// &#93;&#93;&gt;</span><span style="color:#800000">&lt;/script&gt;</span><span style="color:#000080">&lt;/pre&gt;</span><br />
<span style="color:#000080">&lt;div&gt;</span><span style="color:#FF8000">&lt;input id=<span style="color:#0000FF">&quot;msg&quot;</span> type=<span style="color:#0000FF">&quot;text&quot;</span> /&gt;</span><br />
&nbsp;<span style="color:#FF8000">&lt;input id=<span style="color:#0000FF">&quot;broadcast&quot;</span> type=<span style="color:#0000FF">&quot;button&quot;</span> value=<span style="color:#0000FF">&quot;broadcast&quot;</span> /&gt;</span><br />
<span style="color:#000080">&lt;ul id=<span style="color:#0000FF">&quot;messages&quot;</span>&gt;</span><span style="color:#000080">&lt;/ul&gt;</span><br />
<span style="color:#000080">&lt;/div&gt;</span></code><hr />
</div>Tener en cuenta:<br />
<br />
	* Realizar la referencia javascript al jquery.signalR<br />
        &lt;script type=&quot;text/javascript&quot; src=&quot;Scripts/jquery.signalR-1.0.1.min.<acronym title="JavaScript">js</acronym>&quot;&gt;&lt;/script&gt;<br />
<br />
<br />
	* Realizar la referencia javascript al maproute <br />
        &lt;script type=&quot;text/javascript&quot; src=&quot;signalr/hubs&quot;&gt;&lt;/script&gt;<br />
<br />
<br />
	* Inicializar el Hub <br />
        var chat = $.connection.chat;<br />
<br />
Una vez terminado podremos ejecutar la aplicacion y correra un cliente de chat en nuestro navegador. <br />
<br />
Post Original <a href="http://anonym-url.com/go.php?to=http://mariobot.wordpress.com/2013/04/30/signalr-en-asp-net/" target="_blank">SignalR en asp.net | MaRioBoT</a><!-- google_ad_section_end --></div>

]]></content:encoded>
			<category domain="http://comunidad.dragonjar.org/f175/">.Net</category>
			<dc:creator>MaRioBoT</dc:creator>
			<guid isPermaLink="true">http://comunidad.dragonjar.org/f175/signalr-en-asp-net-14629/</guid>
		</item>
	</channel>
</rss>
