Answer the question
In order to leave comments, you need to log in
Transport API messages via socket.io in mobile applications: good or bad?
Actually, I am tormented by the question of how best to implement the API:
1) Do everything (api + sending data / events / etc from the server to the client) using socket.io
2) Make the api separately, the usual REST / JSONRPC + optionally, run socket on desktops .io, for loading data in real time
On the one hand, socket.io allows you to push data from the server to the client in real time and has a bunch of fallbacks. On the other hand - if I'm taking the subway / using slow GPRS - wouldn't socket.io be a big overhead?
Answer the question
In order to leave comments, you need to log in
In this case, the choice is correct. You can of course use HTTP. But in this case, it is a big overhead, because. the connection is reset each time.
The fact that someone's connection is broken somewhere in the metro is the problem of this chela, and the connection will be broken - it will immediately be restored when necessary.
Everything is very simple, the action was really wrong.
Didn't request a directory - <?php echo get_template_directory_uri(); ?>/mail.php
header("refresh:3;url=http://sitename.ru");
Instead, you need to write
it out
Hello.
If it's wordpress, then you'd be better off using the standard way of processing forms.
The form action should be on admin-post.php. Plus, you need to add a hidden field and nounce for form security.
Read about nounce https://codex.wordpress.org/WordPress_Nonces
This is how an example form creation looks like
<form name="loginForm" id="loginForm" action="<?php echo esc_url(get_admin_url() . 'admin-post.php') ?>" method="post">
<input type="hidden" name="action" value="login-form" />
<?php wp_nonce_field('process_login_form_action','login_form_sec_field'); ?>
add_action('admin_post_submit-form', 'process_mail_form_action'); // для залогинненых пользователей
add_action('admin_post_nopriv_submit-form', 'process_mail_form_action'); // для незалогинненых пользователей один и тот же обработчик
function process_mail_form_action()
{
// тут читаете из $_POST
}
If he throws at 404, then he throws somewhere in the wrong place. What is the url of the form page?
In telepath mode: tryaction="/mail.php"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question