Firebase云消息传递可靠性(Firebase Cloud Messaging Reliability)
我们正在构建一个消息传递应用程序,我们正面临着消息传递问题。
我们目前正在使用socket.io在正在运行的应用程序上发送消息,但事实证明它非常不可靠。 (网络速度慢,超时延迟,应用程序处于打盹模式时出现问题,......)
我们正在考虑转向FCM,但我们对可靠性和速度有疑问。 我们不想改变一切,以后看到它不像想要的那样可靠。
您是否已在生产应用中为每条消息使用FCM? 即使应用程序正在运行?
We are building a messaging app and we are facing issues with messages delivery.
We are currently using socket.io to send messages on a running app but it's been proven highly unreliable. (Problem with slow network, late timeout, problem when app is in Doze mode,...)
We are thinking about switching to FCM but we have questions regarding reliability and speed. We don't want to change everything to see afterwards that it's not as reliable as wanted.
Have you already used FCM on a production app for every message ? Even when the app is running ?
原文:https://stackoverflow.com/questions/43000510
最满意答案
如果您翻转类型,可能会更容易看到:
(e -> a) -> (a -> b) -> (e -> b)
我们可以把
e
变成a
,把a
变成b
。 那么我们怎样才能把e
变成b
呢?不要过分关注“提升”; 使用
Functor
实例,发现实现的最佳方法就是遵循类型。It may be easier to see if you flip the types around:
(e -> a) -> (a -> b) -> (e -> b)
We can turn an
e
into ana
, and ana
into ab
. So how can we turn ane
into ab
?Don't focus too much on "lifting"; with
Functor
instances, the best way to discover the implementation is simply to follow the type.
相关问答
更多-
是否有已经定义的mmap ? 叫什么? Hoogle是你的朋友。 (>>=)的类型签名是: (>>=) :: Monad m => m a -> (a -> m b) -> m b 因此,你正在寻找一个类型签名的函数: flip (>>=) :: Monad m => (a -> m b) -> m a -> m b 这实际上是=<<功能。 因此,你可以写fun3 =<< fun2 =<< fun1 。 为什么绑定被定义为一个运算符,其参数的顺序是反向的? 这是因为单代码看起来很像命令式代码。 例如,请 ...
-
我想提出一个答案,提请注意上面八月的评论: 实际上并不是这样。 发生了什么事情是地图的类型被概括为覆盖Haskell 1.3中的Functor。 即,在Haskell 1.3中,fmap被称为地图。 然后,这个更改在Haskell 1.4中被还原,并引入了fmap。 这种变化的原因是教学性的; 当教给Haskell初学者时,非常一般的地图类型的错误信息更难理解。 在我看来,这不是解决问题的正确方法。 Haskell 98被一些Haskellers(包括我)退后一步,以前的版本定义了一个更抽象和一致的库。 好 ...
-
关键在这里: fmap (*) 3 :: (Functor f, Num a, Num (f a)) => f (a -> a) ^^^^^^^^^ 在Haskell中,数字文字被重载,因此只要b具有Num实例, 3就可以有任何类型b 。 编译器进行以下分析: 3具有约束Num b某种类型Num b fmap类型为Functor f => (a -> c) -> fa -> fc 所以*有类型a -> c ,3有类型fa *具有类型Num ...
-
您忘记在Branch节点中包含a s上应用函数f ,否则您只将函数应用于叶子上。 而且,你忘记了Empty构造函数的情况。 instance Functor Tree where fmap f Empty = Empty fmap f (Leaf x) = Leaf (f x) fmap f (Branch a left right) = Branch (f a) (fmap f left) (fmap f right) You are forgetting to apply the func ...
-
您只写Just 1而不是(Just 1) ,因此,这些是两个独立的参数。 现在我们可以用更规范的形式重写它,如: (fmap . fmap) (+1) Just 1 -> (\x -> fmap (fmap x)) (+1) Just 1 -> ((fmap (fmap (+1)) Just) 1 所以现在我们可以分析类型: fmap1 :: Functor f => (a -> b) -> f a -> f b fmap2 :: Functor g => (c -> d) -> g c -> g ...
-
haskell理解fmap(haskell understanding fmap)[2022-11-17]
这是因为xs是Rose a的列表。 也许这更清楚: fmap f (x :> xs) = (f x) :> map (fmap f) xs ^^^ 当然,对于列表, map = fmap 。 那是: 将f应用于x 。 对于xs ,将函数fmap f映射到列表xs It's because xs is a list of Rose a. Perhaps this is clearer: fmap f (x :> xs) = (f x) :> map ( ... -
Haskell:函数和值(Haskell: functions and values)[2021-09-02]
(+3) (+3)只是一个类型错误,因此它不会编译。 (+3)的类型是Int -> Int ,这意味着当应用Int ,我们得到另一个Int 。 它还意味着您只能应用Int类型的值! 因此,您不能将(+3)类型的值应用于Int -> Int ,只能应用Int类型的值。 所以,是的, (+3)是值,但不适合将类型应用于期望类型为Int的值的函数。 Int不能与Int -> Int统一,因为它们具有不同的类型构造函数 ,这使它们成为不同的类型,正如@DanielWagner所指出的那样。 Int -> Int的最 ... -
我们通常不能在fmap方面实现return 。 Monad比Functor更强大。 但是,作为练习,我们可以尝试提出这个问题:如果有的话,第二个操作是否可以实现fmap return ? 我们可以通过查看类型来攻击这个问题。 (我们将使用Applicative类中的pure而不是return它们基本上是相同的操作。) fmap :: Functor f => (a -> b) -> f a -> f b pure :: Applicative f => a -> f a 嗯,这可能是一种可能的方式,如果我 ...
-
fmap在Haskell中的函数(fmap on functions in Haskell)[2024-03-27]
如果您翻转类型,可能会更容易看到: (e -> a) -> (a -> b) -> (e -> b) 我们可以把e变成a ,把a变成b 。 那么我们怎样才能把e变成b呢? 不要过分关注“提升”; 使用Functor实例,发现实现的最佳方法就是遵循类型。 It may be easier to see if you flip the types around: (e -> a) -> (a -> b) -> (e -> b) We can turn an e into an a, and an a int ... -
您可以使用Data.Functor.Compose将嵌套的Data.Functor.Compose / Applicatives视为单个Functor / Applicative: ghci> import Data.Functor.Compose ghci> getCompose (Compose [pure (+2), pure (*2)] <*> Compose [Just 10, Just 20]) [Just 12,Just 22,Just 20,Just 40] 但在这种情况下,( Compo ...