Closed gkio closed 8 years ago
I am not sure what exactly the issue is. Could you outline a little bit more on what you did or give a simplified example of "it not syncing in realtime across clients but still working normally"?
Are you updating one client and not directly seeing the change in the second client?
Please also fill out what version of the generator, node, npm and OS you're using.
created new endpoint with
yo angular-fullstack:endpoing chat
on models of server removed name and info and added name message and time
{name: String,message:String,time:String,active:Boolean}
on view added input if loggedin and view and in main controller added sendMessage like sendThings just with the name of user time and message but its not work like things
i add an message on input and its get it via ng-model and the curretUser and the localtime then its send to db but when i press send its post to /? and its refresh and giving me the data but its not do it Async without refresh and dont give me the message without refresh on other client
So you're making some kind of chat client?
As you might know you'll have to use sockets for that. Can't tell if you chose to add sockets to your application when you generated it but you probably should have. Taking it that you're sending the messages to be saved using the regular express API and mongoose methods, but you'll have to establish some kind of socket connection to continuously update the chat with messages pushed from the server. As the alternative is either refreshing like you're doing or constantly polling for new messages, neither a very good alternative for chats.
Think it's such a common use-case that there should be lots of blog posts, stackoverflow posts and other sites with examples. Should otherwise be pretty straight forward if you just understand how sockets work.
So I would simply point you to Google it.
i just created new endpoint and added input and submit what else i have to do to make it Sync in realtme its works normal but its not syncing