Code: Select all
protected void Page_Load(object sender, EventArgs e)
{
var resp = this.Response;
var msgCallback = new Action<object, OracleQueueMessageEventArgs>((ss, ee) =>
{
// How to pass "Hello" to client side?
resp.Write("Hello");
});
var orc = new OracleQueueMessageEventHandler(msgCallback);
// follow the example https://www.devart.com/dotconnect/oracle/docs/aq.html
OracleQueue oracleDequeueBob = new OracleQueue("MESSAGE_QUEUE", Entry.Connection);
oracleDequeueBob.DequeueOptions.Navigation = OracleQueueNavigation.FirstMessage;
oracleDequeueBob.DequeueOptions.ConsumerName = UserName;
oracleDequeueBob.AsyncNotification = true;
oracleDequeueBob.OnMessage += orc;
}
[WebMethod]
public static void UpdateChat(string text)
{
var oracleEnqueueQueue = new OracleQueue("MESSAGE_QUEUE", Entry.Connection);
OracleQueueMessage message2 = new OracleQueueMessage();
message2.StringPayload = text;
oracleEnqueueQueue.Enqueue(message2);
}
The function msgCallback is called, but I can not to pass "Hello" to client side because the current HttpContext is lost.
How I can pass some text from server side (C#) to client side?