It would be really helpful, if you could optionally timestamp your communication from extension to client. That way you could use server time, e.g. in chat messages.
My workaround is to calculate the difference between server and client time after connecting, and then calculate server time from client time. But it is just a workaround...
Optional timestamp for server communication
So would it be useful for extension messages or chatting? They are not the same thing.It would be really helpful, if you could optionally timestamp your communication from extension to client. That way you could use server time, e.g. in chat messages.
Additionally what would it be the use?
Knowing the server time during a chat doesn't sound very useful as people could be connected from different world regions with different time zones.
For the extension messages I think it would be better to just add the timestamp where needed instead of forcing it in every message. Don't you think?
Adding the server timestamp in an extension response is a matter of one line of code:
Code: Select all
// Actionscript code example
responseObj["tstamp"] = getTimer()
...
...
// Regular sendResponse call
_server.sendResponse(...)Lapo wrote: So would it be useful for extension messages or chatting? They are not the same thing.
Additionally what would it be the use?
I meant chatting. Consider the following: I have a chat where I write every message to a database, to be able to retrieve it later (e.g. for showing the last x messages to newly logged in users). As I show every message with a timestamp, I write the timestamp to the database as well. Now, all these messages are stamped using the server time, because the chat is open during a live web tv show, and I want the timestamps to serve as a reference to when, compared with the show start time, the message have been posted.
The older messages are not sent using dispatchPublicMessage, of course, but are sent in a bulk message using an extension response.
The moment a user posts a message, however, these are sent to clients using dispatchPublicMessage, with no possibility of attaching the timestamp, which means I have to either use an extension respone instead, add the timestamp directly to the message string (nasty), or calculate server time from client time (which I am doing right now, but I am not too proud of that).
Do you know what I mean?