I am trying to create 1 to 1 chat from a web client.
I downloaded the SDK and the group chat example. There seem to be really good examples for all platforms except
I suggest that you might see the 405 error because you have put the call of sendMessage function immediately after the call of connectChat function.
To connect to the chat needs some time, so you can not send the message until your client (browser) hasn't finished the connecting to the chat server at first. You need to put the call of sendMessage function in callback from function connectChat where a status is "Connected". Or you can perform sendMessage function on an onclick event to the tag or something else. For your example, insert sendMessage like here:
case Strophe.Status.CONNECTED:
console.log('[Connection] Connected');
connection.addHandler(onMessage, null, 'message', null, null, null);
connection.send($pres().tree());
sendMessage();
break;