Ajax Chat long polling - c#

After reading this post, I decided to write my own chat application.
Differently from the above post, my application allows more polling, for instance when user presses any key (in order to inform the other one that user1 is writing something) and obviously when a user sends a message.
This causes some problems: often no-one notification is read correctly and the sent message isn't always read from the other side.
It could be great if there was some way to send and receive different notificaion types (message, alert about new writing, new user joined and so on...).
How can I solve this?

Signal R is the solution to your problem. I understand that you want to develop your own solution and that the intrigue can be enticing BUT please consider looking into SignalR - being able to get to grips with and manipulate SignalR will pay dividends and allow you to solve similar problems much more easily - its a great tool to add to your development arsenal.
In fact by all means continue developing your solution but give SignalR the once over for something else or another project it really is worth looking at as the de facto method of achieving this type of client server communication within .net. It can be found on NuGet using the link below so its only a few clicks away!
http://nuget.org/packages/SignalR

I'm glad to inform you my chat app are working now.
The problem was about two call to wcf service in the same javascript eventhandler (send message button, where I notiified the new message and an alert such as "user is not writing anything", yeah, I needed to reset the previous alert ("user is writing a message..").
Now I'm be able to send and receive many notification and all works fine. I've tested it with 10 chat page about.
Surely I know I can achieve more functionality and stability by using the framework you have suggested me, but I'm happy to have found a relative simple, customizable and good solution for my purpose.

Related

dynamic binding between processes

I'm trying to create a system that will be very modular. with the idea in mind that no module should really know about any other module (each running in it's own process).
There will be another program that will open, and will be able to tell what these modules will send and receive(this I largely have covered).
the issue I'm having at the moment, is there a way for me to be able to interrogate the application inside another process, or app domain? and in so doing late bind these modules together.
EG:
A module that can broadcast 'X' at runtime will be liked to a module that can accept 'X'.
This may be quite vague, and if so please ask me to clarify on anything I have not covered.
Right now, I Just need to know if it is possible to interrogate a process, and if so how? I Am fairly new to this but my initial research hasn't taken me to far.
I modeled a system like this recently for a personal home automation system. Basically, I'd want to be able to have certain sensors (microphones, cameras, etc.) broadcast what they have, and have other computers or programs get that information whenever they need it, without knowing exactly who is going to be getting the data at compile time.
If this sounds like what you're looking for, I'd look into a Pub-Sub style architecture.
http://en.wikipedia.org/wiki/Publish%E2%80%93subscribe_pattern
You're not really interrogating the process in this kind of architecture, but I think you get a similar result. Basically, you'll have one main pub-sub server.
In the Diagram above, Clients 2 and 3 "subscribe" to receive a specific kind of message. The server knows who is subscribed to what, so that when Client 1 sends that message, the server knows it needs to route it to the correct clients.
I hope this helps.
EDIT: After re-reading your question, I feel that you may have already gotten this far. Maybe all you need is something like
http://msdn.microsoft.com/en-us/library/bb546102(v=vs.110).aspx
Pipes allow you to pass some information between processes. You'll have to serialize and de-serialize the data across the pipe, but this (coupled with a pub-sub architecture) should give you what you need.

Creating Chatroom in ASP.net

I am trying to create a basic chat room just to enhance my programming and logical skills, but I can't figure out the functionality here.
The question which is bothering me is whether should I include database or not?
(p.s: I don't want to record any chat sessions).
I tried on my own by using Application["variable"] to post messages like.
Application["Message"] = txtMessage.text;
txtDisplay.text = txtDisplay.text + Application["Message"].ToString();
I know this is not the correct way, there will be some limits to store huge amount of messages and can't be implemented on large traffic. I tested it on LAN and it worked fine, but need a proper way to complete my project.
Need a kick start.
If you want a proper solution of the chat utility (with latest technologies including ASP.net MVC), you should consider WebSockets [http://www.codeproject.com/Articles/618032/Using-WebSocket-in-NET-Part] and SignalR [http://www.asp.net/signalr].

Windows Phone 8 Communication

I have various questions about windows phone 8 communications which I hope someone out there will be able to clarify.
What is the best method to communicate between a wp8 device and a server? WCF, OData, Json, Webclient, other? Does anyone know what is the recommend standard if any?
Based on 1, will using SSL or similar work? How do you encrypt data over the wire if SSL is not a an option.
Sample on how to use wcf (or other) using Async Await? The sample I'm working on, though not familiar with it all, I'm using wcf and I'm confused as to how I should go about it. Assume the following basic scenario:
a) The user is provided with a logon page. The user then clicks Login.
b) The proxy is first opened by calling the .Open (should I call openasync?).
c) A wcf call is made to call the .LogonUser (should I call LogonUserAsync?).
d) The proxy is then closed by calling .Close (should I call CloseAsync?).
Again I'm confused as if I don't use asynchronous call, it doesn't feel right, thought it might be ok. Can someone confirm this? Second, if I use async, should I call the .LogonUser from inside the OpenCompleted event and then call the .Close within the LogonUserCompleted? Seems messy and dirty coding? Again I could be completely off, but it just doesn't feel right?
Is there any good sample out there providing and explaining step by step on what should be the correct communication protocol that should be use and how to use it. Most of the wcf sample I'm finding never seem to call the .Open & .Close methods which I assume is a must and that's maybe why it is omitted but again, it's not obvious when you don't know what you're doing.
Should wcf (or any other) always call open & close for each call made i.e. logon, search, etc... rather than keeping this open for the entire session when the application is opened and re-using the same object?
Thanks and sorry for the many questions in one post.
Thanks.
T.
#1 There is no rule of thumb to decide which is the best method amongst: WCF, OData, Json,
I think what should be used should be decided by the requirement. In Windows Phone you can use any of these,.
#2 If you are not using SSL, then you can think of private/public key encryption
#3 I am not sure about whether openasync() should be really used. In one of my project I have consumed WCF service without calling openasync(). You should use Aync methods.

How to know if email is marked as spam by recipient

Today we were discussing about email services in our team. My one team member informed us about Amazon Web Service they are using in their institute to send bulk emails. He said that AWS also give you a report of emails getting bounced back. It is not a difficult task as I think. But, it also reports you if recipient marked it as spam. HOW??
Is it really possible because I could not think of any trick here. Once the email is in recipient's territory(SMTP server) we have no information about it. I am a windows forms guy and not have much knowledge about Web and Web Services. I tried Googling and even Binging this time, but nothing of much use.
Don't expect a code reference or what I have tried. I have spent hours and hours in just searching but ended with no good. Sometimes I feel my friend was lying and if really it was the case, then I must say he has good control over his facial expressions.
Even similar question did not satisfy me much.
Many email providers like Yahoo Mail! and AOL offer so called feedback loops. You, or an email service provider like Amazon, can apply to take part. If accepted, you (or Amazon) will receive a report via email each time one of your recipients clicks "this email is spam". There's also a reporting standard called ARF (Abuse Reporting Format). This way, you (Amazon) can find out how many complaints you got. (Of course the goal is to remove the complainers. They obviously don't want your emails.)
Some resources of interest:
Apply for Yahoo! Feedback Loop
Feedback Loops #wikipedia
List of Feedback Loops (for US mainly)
Infos on ARF and FBL from AOL
I don't think your friend was lying but I think he may have misunderstood.
A receiving server, which may be the final recipient but may also be an intemediate web service, can be configured to automatically send a reply that you have been identified as spam. It is probably this traffic that AWS reports on.
This has pros and cons, the pro is that legit emailers can contact the target and get themselves put on a white list, the con is that a spammer knows he has a live address which, although he can't use it, can be sold to other spammers.

Can you capture the event of sending instant message from Yahoo Messenger and replace text using C#?

I've just made a quick research about that but there is nothing about that in C#.
Is this a lost cause or it can be made?
As Yahoo Messenger is not an open source project, I have no idea about how sending message is implemented. First thing you should do is launching Wireshark on your machine to see how Yahoo Messenger works (which port is used, which protocol, data encryption...etc.).
When you have determined how the application works, you'll have to write some low level code that intercepts and modifies the bytes Yahoo Messenger sends. You'll probably have to write a driver, so it looks to me like a dead-end if your are using C#. And even using C/C++ or any langage usable to write drivers, it'll require a large amount of time/resources IMO.
You are trying to modify behavior of an closed source application. The only thing i can think of is somehow goeing lower-level in the OSI model (Transport layer i.e.) and change values. This sounds like a bad idea.
Actually i even wonder whether that data is sent plain-text or that encryption etc. has been used. I wonder if you can actually change the message at all.

Categories

Resources