2012-12-04 1 views
2

의 경로 groupchat 메시지 ... 내 routes.js에서 어떻게 다음과 같습니다 들어오는 메시지가 좌향 선회

<message 
    from='[email protected]' 
    to='[email protected]' 
    type='groupchat' 
    xmlns='jabber:message:group_chat_test'> 

    <body>Here is my message.</body> 
</message> 

내가 내용 이외의 다른 기반으로 메시지를 라우팅하기 위해 노력하고있어 파일에 몸의 - 특히 나는 사용자 정의 네임 스페이스 (그래서 다른 컨트롤러에 의해 처리 얻을 다른 groupchat 메시지 유형을 가질 수 있습니다) 그래서이 시도에 따라가 ...

bind.query('message[type="groupchat"][xmlns="jabber:message:group_chat_test"]') 
    .to(SD.Messenger.Room, "groupchat_test"); 

그러나 메시지로가는 경로를 원하는 group_chat_test 컨트롤러에 도달하는 대신에 ether. 우리는 <iq> 님과 비슷한 일을하지만 groupchat 메시지에서는 작동하지 않습니다.

내가 누락 된 항목이 있습니까? 이 방법으로 그룹 채팅 메시지를 쿼리 할 수 ​​있어야합니까? 내가 할 수있는 다른 방법이 있습니까?

참고로, 내 현재 해결 방법은이 해킹 ...

SD.Messenger.Room.prototype.all_groupchat_msgs = function() { 
    // test the body of the incoming stanza and 
    // based on it's contents do different things... 
}; 

사용자가 변경할 수없는

답변

1

(Ejabberd, 보쉬, Stroph 사용) controllers.js에두고

bind.query('message[type="groupchat"]').to(SD.Messenger.Room, "all_groupchat_msgs"); 

입니다 주요 XMPP 스탠자 메시지의 네임 스페이스, iq 및 존재. 그 하위 요소에는 사용자 정의 네임 스페이스 만있을 수 있습니다.

IQ가 작동하면 하위 요소 중 하나에 사용자 지정 네임 스페이스가있는 것입니다.

예 :

<iq type='get' id='1' to='[email protected]/resource'> 
    <query xmlns='my-custom-ns'> 
     payload 
    </query> 
</iq> 


<message type='groupchat' to='[email protected]'> 
    <x xmlns='my-custom-ns'> 
     payload 
    </x> 
</message> 
+0

알았어요, 고마워! – dublxdad

1

여기

<message 
    from='[email protected]' 
    to='[email protected]' 
    type='groupchat' 
    custom_subtype='my_custom_type'> 

    <body>Here is my message.</body> 
</message> 

는 사용자 정의에 파일러 속성있는 경로를 만들기 ... ... 사용자 정의 속성을 추가 근무 접근 방식

bind.query('message[type="groupchat"][custom_subtype="my_custom_type"]') 
    .to(Room, "controller_for_my_custom_type"); 
+0

답을 올바른 것으로 표시하십시오. –