首页 \ 问答 \ WebSocket请求响应子协议(WebSocket request-response subprotocol)

WebSocket请求响应子协议(WebSocket request-response subprotocol)

WebSocket提供像人类谈话的双向通信。 客户端可以向服务器发送数据,服务器可以随时向客户端发送数据。 但是问题呢? 请求响应行为? 客户端可以向服务器询问一些信息,等待响应。 似乎Websocket不提供任何将客户端数据(请求)链接到服务器数据(响应)。

这可能是子协议的工作,我有一些关于如何做的想法(用请求发送一个id,并等待具有相同ID的响应,直到超时时间)。

为了不重画轮子并节省一些时间,我在互联网上查看了一个现有的解决方案,但是我没有找到任何相关的东西(也许是坏的关键字)。

那么有人知道这种工作,还是我错过了什么?


WebSocket provide a bi-directional communication like a human being talks. The client can send data to the server and the server can send data to the client at anytime. But what about the question ? the request-response behavior ? The client could ask something to the server and wait for a response. It seems that Websocket doesn't provide anything to link client data (request) to server data (response).

It's probably the work of the subprotocol and I have some ideas on how to do it (send a id with the request and wait for a reponse with the same id until a timeout period).

In order to do not remake the wheel and to save some time, I looked over the internet for a existing solution but I haven't found anything related (maybe bad keywords).

So is there anyone aware about this kind of work or am I missing something ?


原文:https://stackoverflow.com/questions/10882370
更新时间:2023-09-13 07:09

最满意答案

它似乎并不是使用LIKE将是你所需要的最好的方法。 我会研究MySQL FULLTEXT索引来获得基本的功能。 我将不得不多看一些复数的东西,看看是否可以实现。

查看FULLTEXT索引信息的这两个链接。

这是第二篇文章的一个片段:

SELECT headline, story FROM news
WHERE MATCH (headline,story) AGAINST ('Hurricane');

更新:

我发现这个SO帖子 ,其中的评论似乎表明,FULLTEXT索引将考虑到复数和语法形式,但他并没有引用来源,所以我很难肯定地说。 你可以尝试FULLTEXT索引方法吗?


It dosn't seem that using LIKE would be the best approach for what you need. I would look into MySQL FULLTEXT indexing to get the basic functionality working. I'll have to look into the plural thing a bit more to see if that can be accomplished.

Take a look at these two links for FULLTEXT indexing info.

Here is a snippet from the second article:

SELECT headline, story FROM news
WHERE MATCH (headline,story) AGAINST ('Hurricane');

UPDATE:

I found this SO post in which a comment seems to suggest that the FULLTEXT indexing will take plural and grammatical forms into account but he dosn't cite a source, so it's hard for me to say for sure. Can you try the FULLTEXT indexing method?

相关问答

更多
  • 它似乎并不是使用LIKE将是你所需要的最好的方法。 我会研究MySQL FULLTEXT索引来获得基本的功能。 我将不得不多看一些复数的东西,看看是否可以实现。 查看FULLTEXT索引信息的这两个链接。 http://dev.mysql.com/doc/refman/4.1/en/fulltext-search.html http://www.petefreitag.com/item/477.cfm http://dev.mysql.com/doc/refman/5.1/en/fulltext-boole ...
  • 这里直接来自微软: http://msdn.microsoft.com/en-us/library/4x252001(VS.71).aspx 对于大多数枚举类型使用单数名称,但对于位字段的枚举类型使用复数名称。 Here it is straight from Microsoft: http://msdn.microsoft.com/en-us/library/4x252001(VS.71).aspx Use a singular name for most Enum types, but use a pl ...
  • IMHO,表名应该是像客户一样的复数。 如果客户端映射到Customers表中的一行,则类名称应该与Customer类似。 IMHO, Table names should be plural like Customers. Class names should be singular like Customer if it maps to a row in Customers table.
  • 使用/resources的前提是它代表“全部”资源。 如果你做一个GET /resources ,你可能会返回整个集合。 通过POST /resources ,您正在添加到集合。 但是,个人资源在/资源中可用。 如果你做了一个GET /resource ,你可能会出错,因为这个请求没有任何意义,而/resource/123是完美的。 使用/resource而不是/resources类似于如果您使用文件系统和文件集合,并且/resource是其中的个人456文件的“目录”,您将如何执行此操作。 无论是对还是错 ...
  • 您可以搜索嵌套属性,它只需要稍微不同的语法。 您必须指定路径,然后明确使用您正在搜索的每个属性的路径。 本教程很好地概述了嵌套文档的工作方式 。 You can search nested properties, it just requires slightly different syntax. You have to specify the path, and then explicitly use the path for each property you are searching. This ...
  • 你确定你想到了吗? 你有字符串"Templates selected" ,你有条件地将s附加到它的末尾 (这将使它成为"Templates Selecteds" )。 做这个: $('#templateCount').html(templateCount + " Template" + (templateCount === 1 ? "" : "s") + " Selected"); Are you sure you thought this through? You have ...
  • 使用字典,停用词列表(您不想单词化)以及语言规则。 如果您不认识荷兰语,那么我无法帮助您,但会告诉您如何用西班牙语完成,例如: 复数以s结尾,如果没有则完成 如果它以s结尾, 检查它是否是以s结尾的动词或共轭,如果是1,则完成(动词可以添加到停用词列表中) 如果它不是动词,请删除s 如果单词存在于字典中,那就完成了 如果它没有删除前一个字母,并在字典中检查它。 如果它仍然不在那里它是一个例外你需要手动检查异常中的代码(我现在不能想到任何,但它们总是存在:) 当然,这不会直接转化为荷兰语。 一般情况下,提取器 ...
  • 好吧,你需要有条件地输出你现在没有做的's'。 $('.mixcount').html(state.totalShow+' player'+(state.totalShow !== 1 ? 's' : '')); Well, you need to conditionally output the 's', which you're not currently doing. $('.mixcount').html(state.totalShow+' player'+(state.totalShow !== ...
  • 好的,我找到了一个解决方案: ([a-zA-Z]+?)(s\b|\b) 根据需要工作,然后您可以简单地使用第一个匹配作为单词的非数字化版本。 谢谢@Jahroy帮助我找到它。 我为未来的冲浪者添加了这个答案,他们只是想要一个解决方案,但请查看Jahroy的更多深入信息的评论。 Ok I've found a solution: ([a-zA-Z]+?)(s\b|\b) Works as desired, then you can simply use the first match as the unp ...
  • 量词应用于左侧的原子。 如果它是一个组,它将应用于一个组。 如果它是文字符号,则它将应用于此符号。 那么, s? 匹配1或0 s 。 使用 x = re.findall(r'\bdogs?\b', txt) 其中\b是单词边界, s是可选的。 注意:首选使用原始字符串文字来定义正则表达式模式,以避免与转义特殊正则表达式元字符相关的问题。 A quantifier is applied to the atom on the left. If it is a group, it will be applied ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)