Well no, you are not getting your hopes too high. All of the technology exists to accomplish your goals.

In general, you would use 'events' to trigger reading or writing on the server. These events are either user triggered(clicking on a button, for instance) or time-based(interval timer).

I suspect that when you say 'device', you may be trying to communicate with an embedded webserver which usually have limited capabilities as far as server-side scripting. So, you would need to understand the commands that are needed to perform various operations on the server and simply use those commands (probably CGI type) within your Javascript/AJAX code. If you are targeting standard PC based servers like Apache or IIS, then you will have all sorts of PHP, ASP commands available on the server.