-
Update Table Problem
I wrote an .Net adapter that nearly the same to MessengerDemo adapter for MessengerDemo site. I encountered with the problem that : when the first user login into site, his name would not be displayed on the buddies-list, but his name would be displayed on this list if he is the second user or so on. My change to this adapter was only in subscribe method :
Code:
public void Subscribe(string itemName)
{
if (itemName.StartsWith(USER_PREFIX))
{
string userName = itemName.Substring(USER_PREFIX.Length);
if (chatTableDic.ContainsKey(userName))
{
throw new Exception("This user is exist !");
}
lock (synObj)
{
if (!chatTableDic.ContainsKey(userName))
{
chatTableDic.Add(userName, new ChatUser(userName, itemName));
chatParners.Add(userName, new Dictionary<string, ChatUser>());
UpdateOnlineList("ADD", userName, false);
}
}
}
}
private void UpdateOnlineList(string command, string key, bool isForSnapshot)
{
string desTable = LIST_TABLE;
var update = new Hashtable();
update.Add("command", command);
update.Add("key",key);
ThreadPool.QueueUserWorkItem(delegate { listener.Update(desTable, update, isForSnapshot); });
}
(LIST_TABLE is a name of buddy-list table)
So could you tell what i was wrong here?
Thank you so much !
-
You use the LIST_TABLE item in an incorrect way, as you send updates for it regardless that a "subscribe" call has been received for it.
When "subscribe" is received for the user messages item, you have no guarantee that the subscription process for the LIST_TABLE item has been completed. Therefore, the consequent update to LIST_TABLE, even though it is deferred, may be discarded by Lightstreamer.
When the second user comes in, the LIST_TABLE item is already known by Lightstreamer because it is currently subscribed to by the first user. Hence, the related update to LIST_TABLE, if it comes before the subscription, is kept in the item snapshot and can eventually reach the cient.
-
Push HTML to WEB Client
Not sure where to post this question ...
I've created an app using LS and so far everything works fine. I'm using IIS, asp.net, c# etc. I would like to push HTML to the client, mainly html tables to be rendered inside the div elements but it's not working, it's rendering the HTML text instead of the formatted. This is my adapter code:
...
this.TableHeader();
this.TableRow(this._dt1.Rows[0]["dt_StartDateTime"].ToString(), this._dt1.Rows[0]["ds_AdminMessage"].ToString());
this.TableFooter();
this._eventData["admin_messages"] = this._sbTable.ToString();
this._intID_ADMIN = intID;
private void TableHeader()
{
this._sbTable.Length = 0;
this._sbTable.Append("<br/>");
this._sbTable.Append("<table border=0 cellpadding=2; cellspacing=3 width=100%>");
}
private void TableRow(string strCol1, string strCol2)
{
this._sbTable.Append("<tr>");
this._sbTable.Append("<td bgcolor=#fffacd width=20%>" + strCol1 + "</td>");
this._sbTable.Append("<td align=\"right\" bgcolor=#fffacd width=25%>" + strCol2 + "</td>");
this._sbTable.Append("</tr>");
}
private void TableFooter()
{
this._sbTable.Append("</table>");
this._sbTable.Append("<br/>");
}
...
client container
<div id="divAdministrativeMessages_content" runat="server">
<div style="background-color: #FFFFBB; border: solid 1px Black; height: 165px; overflow: auto;">
<div source="lightstreamer" table="signalstable" item="eurusd" field="admin_messages">
</div>
</div>
</div>
Please help, thanks. The link to the page is
http://www8.selfip.com/fxgoldkeyssig...fsignals1.aspx
-
Push of HTML contents has to be enabled on the client Table through setPushedHtmlEnabled.