Jump to content

Update view quando é inserido novo registo numa tabela


Guest NoOne
 Share

Recommended Posts

Boas,

Estou a fazer um website de leilões (a nível de auto-aprendizagem apenas) que na página inicial terá uma listagem de artigos e respectivo tempo para terminar licitação, preço actual e ultima utilizador a licitar. Sempre que um utilizador pressionar o botão licitar será criado um novo registo licitação e serão feitas alterações a dois outros registos de outras tabelas.

O que preciso fazer é, sem efectuar refresh na página completa (e se possível sem fazer múltiplos requests à base de dados todos os segundos), ter uma ligação constante à BD que sempre que verifique a inserção de novos registos seja feito o refresh do artigo em causa.

Foi-me sugerido utilizar comet, mas tou com dificuldades em encontrar qualquer documentação de integração de comet com CakePHP... Já alguém trabalhou com isto? Alguém sabe outra ferramenta, talvez mais fácil de usar, que facilite a execução de long polling (penso que seja esta técnica que tenha que usar para efectuar o que pretendo)?

Citação

"Long polling is a variation of the traditional polling technique and allows to emulate information push from a server to a client. With long polling, the client requests information from the server in a similar way to a normal poll. However, if the server does not have any information available for the client, instead of sending an empty response, the server holds the request and waits for some information to be available. Once the information becomes available (or after a suitable timeout), a complete response is sent to the client. The client will normally then immediately re-request information from the server, so that the server will almost always have an available waiting request that it can use to deliver data in response to an event.

Long polling is itself not a push technology, but can be used under circumstances where a real push is not possible."

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.